summaryrefslogtreecommitdiff
path: root/src/fsck
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-22 18:24:59 +0200
committerLennart Poettering <lennart@poettering.net>2015-10-24 23:03:49 +0200
commit85eca92e2061043d733991b386d8dc10fad0fc30 (patch)
treebc3c54d34f95bc8b34d7834d63e5c5f168afad73 /src/fsck
parent7f66eb931d20cfdb7e1123673f2d6d08c2589bdf (diff)
path-util: rework find_binary(), fsck_exists() and mkfs_exists()
Modernize the code a bit: - Get rid of FOREACH_WORD_SEPARATOR() loop in favour of a extract_first_word() loop. - Remove find_binary()'s "local" flag. It's not reasonably possible to look for binaries on remote systems, we hence should not pretend we could. - When we cannot find a suitable binary, return the last error returned from access() rather than ENOENT unconditionally. - Rework fsck_exists() and mkfs_exists() to return 1 on success, 0 if the implementation is missing and negative on real errors. This is more like we do it in other functions. - Make sure we also detect direct fsck symlinks to "true", rather than just absolute ones to /bin/true.
Diffstat (limited to 'src/fsck')
-rw-r--r--src/fsck/fsck.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 30c846f01d..72a6940849 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -366,12 +366,12 @@ int main(int argc, char *argv[]) {
r = sd_device_get_property_value(dev, "ID_FS_TYPE", &type);
if (r >= 0) {
r = fsck_exists(type);
- if (r == -ENOENT) {
- log_info("fsck.%s doesn't exist, not checking file system on %s", type, device);
- r = 0;
+ if (r < 0)
+ log_warning_errno(r, "Couldn't detect if fsck.%s may be used for %s, proceeding: %m", type, device);
+ else if (r == 0) {
+ log_info("fsck.%s doesn't exist, not checking file system on %s.", type, device);
goto finish;
- } else if (r < 0)
- log_warning_errno(r, "Couldn't detect if fsck.%s may be used for %s: %m", type, device);
+ }
}
if (arg_show_progress) {