Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Staging:C
systemd-mini
0003-fsck-consider-a-fsck-implementation-linked...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch of Package systemd-mini
Based on 571d0134bd464444567cf4eb0d2ed8df40045f36 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 24 Jun 2014 19:37:22 +0200 Subject: [PATCH] fsck: consider a fsck implementation linked to /bin/true non-existant --- src/fsck/fsck.c | 32 ++++++++++++++++++++++---------- src/shared/path-util.c | 26 +++++++++++++++----------- 2 files changed, 37 insertions(+), 21 deletions(-) Index: src/fsck/fsck.c =================================================================== --- src/fsck/fsck.c.orig +++ src/fsck/fsck.c @@ -37,6 +37,7 @@ #include "bus-errors.h" #include "fileio.h" #include "udev-util.h" +#include "path-util.h" static bool arg_skip = false; static bool arg_force = false; @@ -280,16 +281,28 @@ int main(int argc, char *argv[]) { type = udev_device_get_property_value(udev_device, "ID_FS_TYPE"); if (type) { - const char *checker = strappenda("/sbin/fsck.", type); - r = access(checker, X_OK); - if (r < 0) { - if (errno == ENOENT) { - log_info("%s doesn't exist, not checking file system on %s", - checker, device); - return EXIT_SUCCESS; - } else - log_warning("%s cannot be used for %s: %m", - checker, device); + _cleanup_free_ char *p = NULL, *d = NULL; + const char *checker = strappenda("fsck.", type); + r = find_binary(checker, &p); + if (r == -ENOENT) { + log_info("fsck.%s doesn't exist, not checking file system on %s", + type, device); + return EXIT_SUCCESS; + } else if (r < 0) { + log_warning("fsck.%s cannot be used for %s: %m", + type, device); + 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"))) { + log_info("fsck.%s doesn't exist, not checking file system on %s", + type, device); + return EXIT_SUCCESS; } } Index: src/shared/path-util.c =================================================================== --- src/shared/path-util.c.orig +++ src/shared/path-util.c @@ -425,19 +425,21 @@ int path_is_os_tree(const char *path) { int find_binary(const char *name, char **filename) { assert(name); - assert(filename); - if (strchr(name, '/')) { - char *p; + if (is_path(name)) { + if (access(name, X_OK) < 0) + return -errno; + + if (filename) { + char *p; - if (path_is_absolute(name)) - p = strdup(name); - else p = path_make_absolute_cwd(name); - if (!p) - return -ENOMEM; + if (!p) + return -ENOMEM; + + *filename = p; + } - *filename = p; return 0; } else { const char *path; @@ -463,8 +465,10 @@ int find_binary(const char *name, char * continue; } - path_kill_slashes(p); - *filename = p; + if (filename) { + path_kill_slashes(p); + *filename = p; + } return 0; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor