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

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