summaryrefslogtreecommitdiff
path: root/fsck
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2010-12-27 22:30:24 +0100
committerKarel Zak <kzak@redhat.com>2010-12-27 22:31:36 +0100
commit6c6f2af9e3949197cf7a70255895a2f4451f2319 (patch)
treefd31717a95ba72aee4127a1d4dfa3d028d5c3093 /fsck
parent61cbc01a89739ff7c3f668108b15a5ec86963f9b (diff)
downloadutil-linux-old-6c6f2af9e3949197cf7a70255895a2f4451f2319.tar.gz
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')
-rw-r--r--fsck/fsck.c10
1 files changed, 6 insertions, 4 deletions
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;