Xinqi Bao's Git

do not exit on failed smprintf
[slstatus.git] / slstatus.c
index 05faef0..fa12572 100644 (file)
@@ -90,7 +90,7 @@ smprintf(const char *fmt, ...)
        ret = malloc(++len);
        if (ret == NULL) {
                warn("Malloc failed.");
-               exit(1);
+               return "n/a";
        }
 
        va_start(ap, fmt);
@@ -406,7 +406,7 @@ static char *
 run_command(const char *cmd)
 {
        FILE *fp;
-       char buf[64] = "\0";
+       char buf[64] = "n/a";
 
        fp = popen(cmd, "r");
        if (fp == NULL) {