summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2009-06-16 18:43:13 +0200
committerMichael Stapelberg <michael@stapelberg.de>2009-06-16 18:43:13 +0200
commit747c814453bd673a13fdeac23e3c081cc81b8460 (patch)
treee873f0e990ab58ae652519c910f3369ac67841aa
parent15977d8a176bcc24911ba3f3c1c04b7f19cacf4e (diff)
Bugfix: Exit upon errors from printf in dzen2-mode (usually SIGPIPE because dzen2 exited)
This prevents i3status processes from still running on your system after you’ve restarted X and dzen2 is long gone.
-rw-r--r--i3status.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/i3status.c b/i3status.c
index ad4384f..fd781cb 100644
--- a/i3status.c
+++ b/i3status.c
@@ -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