diff --git a/cmd/menu/history.c b/cmd/menu/history.c index aab7c600..3cbbdcf3 100644 --- a/cmd/menu/history.c +++ b/cmd/menu/history.c @@ -82,7 +82,10 @@ history_dump(const char *path, int max) { Binit(&b, fd, OWRITE); hist.next = nil; for(h=first; h; h=h->next) - Bprint(&b, "%s\n", h->string); + if(Bprint(&b, "%s\n", h->string) < 0) { + unlink(tmp); + exit(1); + } Bterm(&b); rename(tmp, path); exit(0); diff --git a/cmd/menu/menu.c b/cmd/menu/menu.c index e5ac1719..d2d7c721 100644 --- a/cmd/menu/menu.c +++ b/cmd/menu/menu.c @@ -265,8 +265,9 @@ kdown_event(Window *w, void *aux, XKeyEvent *e) { int num; KeySym ksym; - buf[0] = 0; + buf[0] = '\0'; num = XLookupString(e, buf, sizeof buf, &ksym, 0); + buf[num] = '\0'; key = XKeysymToString(ksym); if(IsKeypadKey(ksym)) if(ksym == XK_KP_Enter) diff --git a/cmd/wmii/message.c b/cmd/wmii/message.c index a96429af..2ebccfdb 100644 --- a/cmd/wmii/message.c +++ b/cmd/wmii/message.c @@ -907,13 +907,12 @@ msg_nudge(View *v, IxpMsg *m) { void msg_parsecolors(IxpMsg *m, CTuple *col) { CTuple tpl; - static char Ebad[] = "bad color string"; char n; n = loadcolor(&tpl, m->pos, m->end); m->pos += n; if(n == 0 || msg_getword(m, nil)) - error(Ebad); + error("bad color string"); *col = tpl; }