X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/f0070071566ad27fa36c49312e1ba3946cd472b5..7e29da026b31f02c839b40c4dcf7bd87741a5e4a:/components/run_command.c diff --git a/components/run_command.c b/components/run_command.c index e356620..1aaae20 100644 --- a/components/run_command.c +++ b/components/run_command.c @@ -17,10 +17,12 @@ run_command(const char *cmd) } p = fgets(buf, sizeof(buf) - 1, fp); pclose(fp); - if (!p) + if (!p) { return NULL; - if ((p = strrchr(buf, '\n')) != NULL) + } + if ((p = strrchr(buf, '\n'))) { p[0] = '\0'; + } return buf[0] ? buf : NULL; }