aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.def.mk2
-rw-r--r--dwmclock.c14
2 files changed, 12 insertions, 4 deletions
diff --git a/config.def.mk b/config.def.mk
index 2ce7e98..0d5d03d 100644
--- a/config.def.mk
+++ b/config.def.mk
@@ -33,7 +33,7 @@ CFLAGS+=-DEXACT_SLEEP
CC?=gcc
# compiler flags
-CFLAGS+=-std=c99 -Wall -Wextra -pedantic -O2 $(shell pkg-config --cflags x11)
+CFLAGS+=-std=c99 -Wall -Wextra -pedantic -Os $(shell pkg-config --cflags x11)
LDFLAGS+=$(shell pkg-config --libs x11)
# default paths
diff --git a/dwmclock.c b/dwmclock.c
index 95d9679..95a0db0 100644
--- a/dwmclock.c
+++ b/dwmclock.c
@@ -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;
}