improve e2fsck handling
authorJohn Crispin <blogic@openwrt.org>
Tue, 9 Jul 2013 12:30:39 +0000 (14:30 +0200)
committerJohn Crispin <blogic@openwrt.org>
Tue, 9 Jul 2013 12:30:39 +0000 (14:30 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
block.c

diff --git a/block.c b/block.c
index 15f4b0f84156e63a6e7ad665336eb96468b09218..2108a8dab0d4eb557109b5b6b1d3337aed33db16 100644 (file)
--- 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));
        }
 }