diff options
Diffstat (limited to 'components/run_command.c')
-rw-r--r-- | components/run_command.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/components/run_command.c b/components/run_command.c index 942f3c4..93bf6da 100644 --- a/components/run_command.c +++ b/components/run_command.c @@ -15,17 +15,17 @@ run_command(const char *cmd) warn("popen '%s':", cmd); return NULL; } + p = fgets(buf, sizeof(buf) - 1, fp); if (pclose(fp) < 0) { warn("pclose '%s':", cmd); return NULL; } - if (!p) { + if (!p) return NULL; - } - if ((p = strrchr(buf, '\n'))) { + + if ((p = strrchr(buf, '\n'))) p[0] = '\0'; - } return buf[0] ? buf : NULL; } |