mirror of
https://github.com/systemd/systemd.git
synced 2025-01-27 18:04:05 +03:00
fsck: consider a fsck implementation linked to /bin/true non-existant
This commit is contained in:
parent
fbe1a1a94f
commit
571d0134bd
@ -302,15 +302,11 @@ int main(int argc, char *argv[]) {
|
|||||||
type = udev_device_get_property_value(udev_device, "ID_FS_TYPE");
|
type = udev_device_get_property_value(udev_device, "ID_FS_TYPE");
|
||||||
if (type) {
|
if (type) {
|
||||||
r = fsck_exists(type);
|
r = fsck_exists(type);
|
||||||
if (r < 0) {
|
if (r == -ENOENT) {
|
||||||
if (r == -ENOENT) {
|
log_info("fsck.%s doesn't exist, not checking file system on %s", type, device);
|
||||||
log_info("fsck.%s doesn't exist, not checking file system on %s",
|
return EXIT_SUCCESS;
|
||||||
type, device);
|
} else if (r < 0)
|
||||||
return EXIT_SUCCESS;
|
log_warning("fsck.%s cannot be used for %s: %s", type, device, strerror(-r));
|
||||||
} else
|
|
||||||
log_warning("fsck.%s cannot be used for %s: %s",
|
|
||||||
type, device, strerror(-r));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_show_progress)
|
if (arg_show_progress)
|
||||||
|
@ -49,10 +49,13 @@ int generator_write_fsck_deps(
|
|||||||
if (!isempty(fstype) && !streq(fstype, "auto")) {
|
if (!isempty(fstype) && !streq(fstype, "auto")) {
|
||||||
int r;
|
int r;
|
||||||
r = fsck_exists(fstype);
|
r = fsck_exists(fstype);
|
||||||
if (r < 0) {
|
if (r == -ENOENT) {
|
||||||
log_warning("Checking was requested for %s, but fsck.%s cannot be used: %s", what, fstype, strerror(-r));
|
|
||||||
/* treat missing check as essentially OK */
|
/* treat missing check as essentially OK */
|
||||||
return r == -ENOENT ? 0 : r;
|
log_debug("Checking was requested for %s, but fsck.%s does not exist: %s", what, fstype, strerror(-r));
|
||||||
|
return 0;
|
||||||
|
} else if (r < 0) {
|
||||||
|
log_warning("Checking was requested for %s, but fsck.%s cannot be used: %s", what, fstype, strerror(-r));
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ int path_is_os_tree(const char *path) {
|
|||||||
int find_binary(const char *name, char **filename) {
|
int find_binary(const char *name, char **filename) {
|
||||||
assert(name);
|
assert(name);
|
||||||
|
|
||||||
if (strchr(name, '/')) {
|
if (is_path(name)) {
|
||||||
if (access(name, X_OK) < 0)
|
if (access(name, X_OK) < 0)
|
||||||
return -errno;
|
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) {
|
int fsck_exists(const char *fstype) {
|
||||||
|
_cleanup_free_ char *p = NULL, *d = NULL;
|
||||||
const char *checker;
|
const char *checker;
|
||||||
|
int r;
|
||||||
|
|
||||||
checker = strappenda("fsck.", fstype);
|
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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user