summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Heimpold <mhei@heimpold.de>2018-11-24 10:22:53 +0100
committerJohn Crispin <john@phrozen.org>2018-11-26 09:45:47 +0100
commit091aa3d72dcbbfdb4795bb17e260e35a635b0bf5 (patch)
treec42797109064a3d0f227529c1ac6701d2f4881fc
parent29e53af0b91954ca6a13bdd1f0e67c939ccb8e6d (diff)
downloadfstools-091aa3d72dcbbfdb4795bb17e260e35a635b0bf5.tar.gz
fstools: guard usage of WEXITSTATUS
According to man page, using WEXITSTATUS should be guarded by a check of WIFEXITED, so add this check. While at, also print an error message in case fsck was terminated by a signal. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
-rw-r--r--block.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block.c b/block.c
index 2e3841a..07719a3 100644
--- a/block.c
+++ b/block.c
@@ -757,8 +757,10 @@ static void check_filesystem(struct probe_info *pr)
int status;
waitpid(pid, &status, 0);
- if (WEXITSTATUS(status))
+ if (WIFEXITED(status) && WEXITSTATUS(status))
ULOG_ERR("check_filesystem: %s returned %d\n", ckfs, WEXITSTATUS(status));
+ if (WIFSIGNALED(status))
+ ULOG_ERR("check_filesystem: %s terminated by %s\n", ckfs, strsignal(WTERMSIG(status)));
}
}