Blame SOURCES/e2fsprogs-1.45.6-libss-Add-missing-error-handling-for-fdopen.patch

f239de
From 91a846631015734d322d11e3b8ff82d650ab7a8e Mon Sep 17 00:00:00 2001
f239de
From: Lukas Czerner <lczerner@redhat.com>
f239de
Date: Fri, 6 Aug 2021 11:58:19 +0200
f239de
Subject: [PATCH 43/46] libss: Add missing error handling for fdopen()
f239de
Content-Type: text/plain
f239de
f239de
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
f239de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
f239de
---
f239de
 lib/ss/list_rqs.c | 9 +++++++++
f239de
 1 file changed, 9 insertions(+)
f239de
f239de
diff --git a/lib/ss/list_rqs.c b/lib/ss/list_rqs.c
f239de
index 021a3835..89e37bb2 100644
f239de
--- a/lib/ss/list_rqs.c
f239de
+++ b/lib/ss/list_rqs.c
f239de
@@ -12,6 +12,9 @@
f239de
  */
f239de
 #include "config.h"
f239de
 #include "ss_internal.h"
f239de
+#ifdef HAVE_UNISTD_H
f239de
+#include <unistd.h>
f239de
+#endif
f239de
 #include <signal.h>
f239de
 #include <setjmp.h>
f239de
 #include <sys/wait.h>
f239de
@@ -46,6 +49,12 @@ void ss_list_requests(int argc __SS_ATTR((unused)),
f239de
         return;
f239de
     }
f239de
     output = fdopen(fd, "w");
f239de
+    if (!output) {
f239de
+        perror("fdopen");
f239de
+        close(fd);
f239de
+        (void) signal(SIGINT, func);
f239de
+        return;
f239de
+    }
f239de
     sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0);
f239de
 
f239de
     fprintf (output, "Available %s requests:\n\n",
f239de
-- 
f239de
2.35.1
f239de