summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Rumbaugh <doug@douglasrumbaugh.com>2022-12-02 22:13:32 -0500
committerDouglas Rumbaugh <doug@douglasrumbaugh.com>2022-12-02 22:13:32 -0500
commit91489267b8eed6be9fbebdaad9371799982c93fa (patch)
tree25893d21a9529a85c8420eaa1df77fa9685eefaa
parent85543c2d60bdc8fcdf3bb479b7481b9169f69fa4 (diff)
downloaddwm-91489267b8eed6be9fbebdaad9371799982c93fa.tar.gz
Warning cleanup
-rw-r--r--config.mk2
-rw-r--r--dwm.c22
2 files changed, 17 insertions, 7 deletions
diff --git a/config.mk b/config.mk
index ff9e508..e56368f 100644
--- a/config.mk
+++ b/config.mk
@@ -28,7 +28,7 @@ LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-r
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
-CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
+CFLAGS = -std=c2x -pedantic -Wall -Wno-deprecated-declarations -Wno-unused-function -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS}
# Solaris
diff --git a/dwm.c b/dwm.c
index 27189bb..94d0cd1 100644
--- a/dwm.c
+++ b/dwm.c
@@ -973,16 +973,15 @@ drawbar(Monitor *m)
return;
/* draw status first so it can be overdrawn by tags later */
- char *text, *s, ch;
+ char *s, ch;
x = 0;
- for (text = s = stext; *s; s++) {
+ for (s = stext; *s; s++) {
if ((unsigned char)(*s) < ' ') {
ch = *s;
*s = '\0';
tw = m->ww - drawstatusbar(m, bh, stext);
x += tw;
*s = ch;
- text = s + 1;
}
}
@@ -1160,7 +1159,10 @@ getstatusbarpid()
if (statuspid > 0) {
snprintf(buf, sizeof(buf), "/proc/%u/cmdline", statuspid);
if ((fp = fopen(buf, "r"))) {
- fgets(buf, sizeof(buf), fp);
+ if(fgets(buf, sizeof(buf), fp) == NULL && ferror(fp)) {
+ perror("get_statusbarpid:");
+ die("fgets");
+ }
while ((c = strchr(str, '/')))
str = c + 1;
fclose(fp);
@@ -1170,7 +1172,12 @@ getstatusbarpid()
}
if (!(fp = popen("pidof -s "STATUSBAR, "r")))
return -1;
- fgets(buf, sizeof(buf), fp);
+
+ if(fgets(buf, sizeof(buf), fp) == NULL && ferror(fp)) {
+ perror("get_statusbarpid:");
+ die("fgets");
+ }
+
pclose(fp);
return strtol(buf, NULL, 10);
}
@@ -2548,7 +2555,10 @@ getparentprocess(pid_t p)
if (!(f = fopen(buf, "r")))
return 0;
- fscanf(f, "%*u %*s %*c %u", &v);
+ if (fscanf(f, "%*u %*s %*c %u", &v) == EOF && ferror(f)) {
+ perror("getparentprocess");
+ die("fscanf");
+ }
fclose(f);
#endif /* __linux__*/