Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
| inline |
side by side
Check return value of pclose()
[slstatus.git]
/
components
/
run_command.c
diff --git
a/components/run_command.c
b/components/run_command.c
index
b5eeff0
..
7ae1b69
100644
(file)
--- a/
components/run_command.c
+++ b/
components/run_command.c
@@
-16,7
+16,10
@@
run_command(const char *cmd)
return NULL;
}
p = fgets(buf, sizeof(buf) - 1, fp);
- pclose(fp);
+ if (pclose(fp) < 0) {
+ warn("pclose '%s':", cmd);
+ return NULL;
+ }
if (!p) {
return NULL;
}