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

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