summaryrefslogtreecommitdiff
path: root/src/shared/generator.c
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2014-04-12 16:07:45 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-12 17:23:13 -0400
commiteb66db55fc4b342e4253065886e0cc0419c45a07 (patch)
treeba9a5862de90e86b3ebeb662a7746cc740618eeb /src/shared/generator.c
parentb189101727e80a09864c5e5880663ef565467f19 (diff)
fsck: Search for fsck.type in PATH
Modifies find_binary() to accept NULL in the second argument. fsck.type lookup logic moved to new fsck_exists() function, with a test.
Diffstat (limited to 'src/shared/generator.c')
-rw-r--r--src/shared/generator.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 61103031db..5ac7b5f02f 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <string.h>
#include <unistd.h>
#include "util.h"
@@ -26,6 +27,7 @@
#include "mkdir.h"
#include "unit-name.h"
#include "generator.h"
+#include "path-util.h"
int generator_write_fsck_deps(
FILE *f,
@@ -45,16 +47,12 @@ int generator_write_fsck_deps(
}
if (!isempty(fstype) && !streq(fstype, "auto")) {
- const char *checker;
int r;
-
- checker = strappenda("/sbin/fsck.", fstype);
- r = access(checker, X_OK);
+ r = fsck_exists(fstype);
if (r < 0) {
- log_warning("Checking was requested for %s, but %s cannot be used: %m", what, checker);
-
+ log_warning("Checking was requested for %s, but fsck.%s cannot be used: %s", what, fstype, strerror(-r));
/* treat missing check as essentially OK */
- return errno == ENOENT ? 0 : -errno;
+ return r == -ENOENT ? 0 : r;
}
}