From 4236e323e8ab4f13770e1ac9e94666b304b693fb Mon Sep 17 00:00:00 2001 From: Henrik Riomar Date: Tue, 24 Jul 2018 21:59:36 +0000 Subject: [PATCH] path_utils_ut: allow single / as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_266 Multiple successive slashes are considered to be the same as one slash. When running the tests on a musl libc system get_dirname(p, PATH_MAX, "//foo//") actually results in a / and not // Reviewed-by: Michal Židek --- path_utils/path_utils_ut.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/path_utils/path_utils_ut.c b/path_utils/path_utils_ut.c index 27c99b6..061abfb 100644 --- a/path_utils/path_utils_ut.c +++ b/path_utils/path_utils_ut.c @@ -62,7 +62,7 @@ START_TEST(test_dirname) fail_unless_str_equal(p, "//foo"); fail_unless(get_dirname(p, PATH_MAX, "//foo//") == SUCCESS); - fail_unless_str_equal(p, "//"); + fail_unless(!strcmp(p, "/") || !strcmp(p, "//")); fail_unless(get_dirname(p, PATH_MAX, "foo//bar") == SUCCESS); fail_unless_str_equal(p, "foo"); -- 2.18.0