diff options
author | clsr <clsr@clsr.net> | 2019-06-09 13:44:41 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2019-06-09 13:44:41 +0200 |
commit | 4d794cd69d5308a88a2453f3613260f0db8be8a7 (patch) | |
tree | 82b4a72c20651e9f5fa078b72b912194ca208a9e /dwmclock.c | |
parent | ffd6ffe68781a88d2711399ef74772b7fa0ecdcb (diff) | |
download | dwmclock-4d794cd69d5308a88a2453f3613260f0db8be8a7.tar.gz dwmclock-4d794cd69d5308a88a2453f3613260f0db8be8a7.zip |
Handle XOpenDisplay failure and close std{in,out,err} when runv1.3.1
Diffstat (limited to 'dwmclock.c')
-rw-r--r-- | dwmclock.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -91,11 +91,19 @@ int main(void) sigaction(SIGQUIT, &act, NULL); sigaction(SIGTERM, &act, NULL); - disp = XOpenDisplay(NULL); + if (!(disp = XOpenDisplay(NULL))) { + return EXIT_FAILURE; + } screen = DefaultScreen(disp); - root = RootWindow(disp, screen); + if (!(root = RootWindow(disp, screen))) { + return EXIT_FAILURE; + } XFetchName(disp, root, &origname); + fclose(stdin); + fclose(stdout); + fclose(stderr); + #ifdef BATTERY for (i=0; !stop; ++i) { #else @@ -155,5 +163,5 @@ int main(void) } XCloseDisplay(disp); - return 0; + return EXIT_SUCCESS; } |