]> git.sur5r.net Git - i3/i3status/commitdiff
Bugfix: Exit upon errors from printf in dzen2-mode (usually SIGPIPE because dzen2...
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 16 Jun 2009 16:43:13 +0000 (18:43 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 16 Jun 2009 16:43:13 +0000 (18:43 +0200)
This prevents i3status processes from still running on your system
after you’ve restarted X and dzen2 is long gone.

i3status.c

index ad4384f49f685f656e73d23a900a8a75481bc386..fd781cb344423f5a3db5ae96850dfe08ad514c20 100644 (file)
@@ -221,11 +221,18 @@ static void setup(void) {
 static void write_to_statusbar(const char *name, const char *message, bool final_entry) {
 #ifdef DZEN
         if (final_entry) {
-                (void)printf("%s^p(6)\n", message);
+                if (printf("%s^p(6)\n", message) < 0) {
+                        perror("printf");
+                        exit(1);
+                }
+
                 fflush(stdout);
                 return;
         }
-        (void)printf("%s" BAR, message);
+        if (printf("%s" BAR, message) < 0) {
+                perror("printf");
+                exit(1);
+        }
         return;
 #endif