Browse Source

Print unknown_str in case of error

func can return NULL in case of error, but no checking is done when
printing, and unknown_str wasn't being used anywhere.
master
SiIky 6 years ago
parent
commit
9ca1ac62f9
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      slstatus.c

+ 3
- 1
slstatus.c View File

@@ -87,8 +87,10 @@ main(int argc, char *argv[])

status[0] = '\0';
for (i = len = 0; i < LEN(args); i++) {
const char * res = args[i].func(args[i].args);
res = (res == NULL) ? unknown_str : res;
len += snprintf(status + len, sizeof(status) - len,
args[i].fmt, args[i].func(args[i].args));
args[i].fmt, res);

if (len >= sizeof(status)) {
status[sizeof(status) - 1] = '\0';


Loading…
Cancel
Save