SHA256
1
0
forked from pool/systemd
systemd/0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch

111 lines
4.0 KiB
Diff
Raw Normal View History

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(-)
Accepting request 242359 from Base:System - Disable blkrrpart for SLES12 and below - Add upstream patch 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch - Add with condition blkrrpart to be able to disable the patches 1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054 which uses the BLKRRPART ioctl for e.g. synthesize change events which may interfere with other tools like parted. - Update handle-disable_caplock-and-compose_table-and-kbd_rate.patch, handle-numlock-value-in-etc-sysconfig-keyboard.patch: read /etc/vconsole.conf after /etc/sysconfig/(keyboard,console) otherwise empty value in /etc/sysconfig/keyboard might override /etc/vconsole.conf values. - Update : 0001-journal-compress-return-early-in-uncompress_startswi.patch 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch 0002-vconsole-setup-run-setfont-before-loadkeys.patch 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch apply-ACL-for-nvidia-device-nodes.patch keep-crypt-password-prompt.patch log-target-null-instead-kmsg.patch parse-crypttab-for-noauto-option.patch set-and-use-default-logconsole.patch: fix all warnings in code - Remove 0001-compress-fix-return-value.patch: not relevant to systemd v210 code. - Also change udev-generate-peristent-rule to udev-generate-persistent-rule OBS-URL: https://build.opensuse.org/request/show/242359 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
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;
}
}
Accepting request 242359 from Base:System - Disable blkrrpart for SLES12 and below - Add upstream patch 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch - Add with condition blkrrpart to be able to disable the patches 1025, 1027, 1029, 1030, 1031, 1032, 1033, 1034, 1037, and 1054 which uses the BLKRRPART ioctl for e.g. synthesize change events which may interfere with other tools like parted. - Update handle-disable_caplock-and-compose_table-and-kbd_rate.patch, handle-numlock-value-in-etc-sysconfig-keyboard.patch: read /etc/vconsole.conf after /etc/sysconfig/(keyboard,console) otherwise empty value in /etc/sysconfig/keyboard might override /etc/vconsole.conf values. - Update : 0001-journal-compress-return-early-in-uncompress_startswi.patch 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch 0002-vconsole-setup-run-setfont-before-loadkeys.patch 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch apply-ACL-for-nvidia-device-nodes.patch keep-crypt-password-prompt.patch log-target-null-instead-kmsg.patch parse-crypttab-for-noauto-option.patch set-and-use-default-logconsole.patch: fix all warnings in code - Remove 0001-compress-fix-return-value.patch: not relevant to systemd v210 code. - Also change udev-generate-peristent-rule to udev-generate-persistent-rule OBS-URL: https://build.opensuse.org/request/show/242359 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=195
2014-07-26 12:19:44 +02:00
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;
}