diff options
author | Karel Zak | 2010-12-27 22:30:24 +0100 |
---|---|---|
committer | Karel Zak | 2010-12-27 22:31:36 +0100 |
commit | 6c6f2af9e3949197cf7a70255895a2f4451f2319 (patch) | |
tree | fd31717a95ba72aee4127a1d4dfa3d028d5c3093 /fsck/fsck.c | |
parent | lsblk: rename "RA" column to "RE" (diff) | |
download | kernel-qcow2-util-linux-6c6f2af9e3949197cf7a70255895a2f4451f2319.tar.gz kernel-qcow2-util-linux-6c6f2af9e3949197cf7a70255895a2f4451f2319.tar.xz kernel-qcow2-util-linux-6c6f2af9e3949197cf7a70255895a2f4451f2319.zip |
fsck: returns proper code on exec() error
# fsck -t foo /dev/sda1; echo $?
fsck: fsck.foo: not found
/sbin/fsck: Error 2 while executing fsck.foo for /dev/sda1
0
new version:
# fsck -t foo /dev/sda1; echo $?
fsck: fsck.foo: not found
fsck: Error 2 while executing fsck.foo for /dev/sda1
8
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=619139
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fsck/fsck.c')
-rw-r--r-- | fsck/fsck.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c index 6a58d7bf3..87f8210f6 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -778,7 +778,7 @@ static int wait_many(int flags) * If the type isn't specified by the user, then use either the type * specified in /etc/fstab, or DEFAULT_FSTYPE. */ -static void fsck_device(struct fs_info *fs, int interactive) +static int fsck_device(struct fs_info *fs, int interactive) { const char *type; int retval; @@ -800,7 +800,9 @@ static void fsck_device(struct fs_info *fs, int interactive) fprintf(stderr, _("%s: Error %d while executing fsck.%s " "for %s\n"), progname, retval, type, fs->device); num_running--; + return EXIT_ERROR; } + return 0; } @@ -1128,7 +1130,7 @@ static int check_all(NOARGS) if (fs) { if (!skip_root && !ignore(fs) && !(ignore_mounted && is_mounted(fs->device))) { - fsck_device(fs, 1); + status |= fsck_device(fs, 1); status |= wait_many(FLAG_WAIT_ALL); if (status > EXIT_NONDESTRUCT) return status; @@ -1179,7 +1181,7 @@ static int check_all(NOARGS) /* * Spawn off the fsck process */ - fsck_device(fs, serialize); + status |= fsck_device(fs, serialize); fs->flags |= FLAG_DONE; /* @@ -1467,7 +1469,7 @@ int main(int argc, char *argv[]) } if (ignore_mounted && is_mounted(fs->device)) continue; - fsck_device(fs, interactive); + status |= fsck_device(fs, interactive); if (serialize || (max_running && (num_running >= max_running))) { struct fsck_instance *inst; |