From eb66db55fc4b342e4253065886e0cc0419c45a07 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Sat, 12 Apr 2014 16:07:45 -0400 Subject: 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. --- src/test/test-path-util.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/test') diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index bec2a83611..a2cf0af75f 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -158,9 +158,20 @@ static void test_prefixes(void) { } } +static void test_fsck_exists(void) { + /* Ensure we use a sane default for PATH. */ + unsetenv("PATH"); + + /* fsck.minix is provided by util-linux and will probably exist. */ + assert_se(fsck_exists("minix") == 0); + + assert_se(fsck_exists("AbCdE") == -ENOENT); +} + int main(void) { test_path(); test_find_binary(); test_prefixes(); + test_fsck_exists(); return 0; } -- cgit v1.2.3-54-g00ecf