]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libss: fix fd error handling
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 12 Dec 2013 18:11:06 +0000 (13:11 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 Dec 2013 18:11:07 +0000 (13:11 -0500)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ss/help.c
lib/ss/list_rqs.c

index 6a61e70a15d92c7337c1f9802288ae83b398f29d..5278c953a558cdc9371f91c5968ac01931477d07 100644 (file)
@@ -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 */
index 38e6aef0539fe9d9f6c04f69589a7c8a93da44c6..6baed419f67af1074f45305bb5ae2acc5c1dc49d 100644 (file)
@@ -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);