summaryrefslogtreecommitdiff
path: root/src/shared/path-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-24 19:37:22 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-25 10:04:36 +0200
commit571d0134bd464444567cf4eb0d2ed8df40045f36 (patch)
tree0039138a0d652a453bc9604375f32489347a3b82 /src/shared/path-util.c
parentfbe1a1a94f19112d7e5d60c40d87487ad24e2ce4 (diff)
fsck: consider a fsck implementation linked to /bin/true non-existant
Diffstat (limited to 'src/shared/path-util.c')
-rw-r--r--src/shared/path-util.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index fd35e0c786..e68d3677a7 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -541,7 +541,7 @@ int path_is_os_tree(const char *path) {
int find_binary(const char *name, char **filename) {
assert(name);
- if (strchr(name, '/')) {
+ if (is_path(name)) {
if (access(name, X_OK) < 0)
return -errno;
@@ -626,8 +626,25 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd
}
int fsck_exists(const char *fstype) {
+ _cleanup_free_ char *p = NULL, *d = NULL;
const char *checker;
+ int r;
checker = strappenda("fsck.", fstype);
- return find_binary(checker, NULL);
+
+ r = find_binary(checker, &p);
+ if (r < 0)
+ return r;
+
+ /* An fsck that is linked to /bin/true is a non-existant
+ * fsck */
+
+ r = readlink_malloc(p, &d);
+ if (r >= 0 &&
+ (path_equal(d, "/bin/true") ||
+ path_equal(d, "/usr/bin/true") ||
+ path_equal(d, "/dev/null")))
+ return -ENOENT;
+
+ return 0;
}