From 01c0caf457a55488cfb749a0c17bbbd7e24d4328 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 9 Jul 2013 14:30:39 +0200 Subject: [PATCH] improve e2fsck handling Signed-off-by: John Crispin --- block.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 15f4b0f..2108a8d 100644 --- a/block.c +++ b/block.c @@ -456,11 +456,10 @@ static void check_filesystem(struct blkid_struct_probe *pr) return; } - if (stat(e2fsck, &statbuf) < 0) - return; - - if (!(statbuf.st_mode & S_IXUSR)) + if (stat(e2fsck, &statbuf) < 0) { + fprintf(stderr, "check_filesystem: %s not found\n", e2fsck); return; + } pid = fork(); if (!pid) { @@ -468,7 +467,10 @@ static void check_filesystem(struct blkid_struct_probe *pr) exit(-1); } else if (pid > 0) { int status; + waitpid(pid, &status, 0); + if (WEXITSTATUS(status)) + fprintf(stderr, "check_filesystem: %s returned %d\n", e2fsck, WEXITSTATUS(status)); } } -- 2.30.2