From 6c6f2af9e3949197cf7a70255895a2f4451f2319 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 27 Dec 2010 22:30:24 +0100 Subject: 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 --- fsck/fsck.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'fsck') diff --git a/fsck/fsck.c b/fsck/fsck.c index 6a58d7bf..87f8210f 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; -- cgit v1.2.3