[PATCH 25/74] libss: fix fd error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 lib/ss/help.c     |    1 +
 lib/ss/list_rqs.c |    5 +++++
 2 files changed, 6 insertions(+)


diff --git a/lib/ss/help.c b/lib/ss/help.c
index 6a61e70..5278c95 100644
--- a/lib/ss/help.c
+++ b/lib/ss/help.c
@@ -110,6 +110,7 @@ void ss_help (argc, argv, sci_idx, info_ptr)
     switch (child = fork()) {
     case -1:
 	ss_perror(sci_idx, errno, "Can't fork for pager");
+	(void) close(fd);
 	return;
     case 0:
 	(void) dup2(fd, 0); /* put file on stdin */
diff --git a/lib/ss/list_rqs.c b/lib/ss/list_rqs.c
index 38e6aef..6baed41 100644
--- a/lib/ss/list_rqs.c
+++ b/lib/ss/list_rqs.c
@@ -45,6 +45,11 @@ void ss_list_requests(int argc __SS_ATTR((unused)),
     sigprocmask(SIG_BLOCK, &igmask, &omask);
     func = signal(SIGINT, SIG_IGN);
     fd = ss_pager_create();
+    if (fd < 0) {
+        perror("ss_pager_create");
+        (void) signal(SIGINT, func);
+        return;
+    }
     output = fdopen(fd, "w");
     sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux