Check result of fputs (CID 1440024)
authorRicardo Mones <ricardo@mones.org>
Tue, 19 Feb 2019 18:23:38 +0000 (19:23 +0100)
committerRicardo Mones <ricardo@mones.org>
Tue, 19 Feb 2019 18:23:38 +0000 (19:23 +0100)
src/main.c

index 1fc5c70..518ea75 100644 (file)
@@ -2417,7 +2417,10 @@ static gint prohibit_duplicate_launch(void)
                        fd_gets(uxsock, buf, sizeof(buf) - 1);
                        buf[sizeof(buf) - 1] = '\0';
                        if (!strncmp(buf, ".\n", 2)) break;
-                       claws_fputs(buf, stdout);
+                       if (claws_fputs(buf, stdout) == EOF) {
+                               g_warning("writing to stdout failed.");
+                               break;
+                       }
                }
        } else if (cmd.exit) {
                fd_write_all(uxsock, "exit\n", 5);
@@ -2428,7 +2431,10 @@ static gint prohibit_duplicate_launch(void)
                        fd_gets(uxsock, buf, sizeof(buf) - 1);
                        buf[sizeof(buf) - 1] = '\0';
                        if (!strncmp(buf, ".\n", 2)) break;
-                       claws_fputs(buf, stdout);
+                       if (claws_fputs(buf, stdout) == EOF) {
+                               g_warning("writing to stdout failed.");
+                               break;
+                       }
                }
        } else if (cmd.reset_statistics) {
                fd_write(uxsock, "reset_statistics\n", 17);
@@ -2448,7 +2454,10 @@ static gint prohibit_duplicate_launch(void)
                        fd_gets(uxsock, buf, sizeof(buf) - 1);
                        buf[sizeof(buf) - 1] = '\0';
                        if (!strncmp(buf, ".\n", 2)) break;
-                       claws_fputs(buf, stdout);
+                       if (claws_fputs(buf, stdout) == EOF) {
+                               g_warning("writing to stdout failed.");
+                               break;
+                       }
                }
        } else {
 #ifdef G_OS_UNIX