diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-04 14:40:56 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-28 13:44:38 +0900 |
commit | 0195046449fc1cf946fe3087b7304a600453dbdd (patch) | |
tree | 940a826836968b4c469e122aab16d15263e307b6 /src/test/test-tmpfile-util.c | |
parent | 484cd43cae536d952cd84abfda3260235dc893cc (diff) | |
download | systemd-0195046449fc1cf946fe3087b7304a600453dbdd.tar.gz |
path-util: make path_extract_filename/directory() handle "." gracefully
This makes the functions handle "xx/" and "xx/." as equivalent.
Moreover, now path_extract_directory() returns normalized path, that is
no redundant "/" or "/./" are contained.
Diffstat (limited to 'src/test/test-tmpfile-util.c')
-rw-r--r-- | src/test/test-tmpfile-util.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/test-tmpfile-util.c b/src/test/test-tmpfile-util.c index 83bac15d00..af18df1bd5 100644 --- a/src/test/test-tmpfile-util.c +++ b/src/test/test-tmpfile-util.c @@ -26,8 +26,10 @@ static void test_tempfn_random_one(const char *p, const char *extra, const char } static void test_tempfn_random(void) { + log_info("/* %s */", __func__); + test_tempfn_random_one("", NULL, NULL, -EINVAL); - test_tempfn_random_one(".", NULL, NULL, -EINVAL); + test_tempfn_random_one(".", NULL, NULL, -EADDRNOTAVAIL); test_tempfn_random_one("..", NULL, NULL, -EINVAL); test_tempfn_random_one("/", NULL, NULL, -EADDRNOTAVAIL); @@ -68,8 +70,10 @@ static void test_tempfn_xxxxxx_one(const char *p, const char *extra, const char } static void test_tempfn_xxxxxx(void) { + log_info("/* %s */", __func__); + test_tempfn_xxxxxx_one("", NULL, NULL, -EINVAL); - test_tempfn_xxxxxx_one(".", NULL, NULL, -EINVAL); + test_tempfn_xxxxxx_one(".", NULL, NULL, -EADDRNOTAVAIL); test_tempfn_xxxxxx_one("..", NULL, NULL, -EINVAL); test_tempfn_xxxxxx_one("/", NULL, NULL, -EADDRNOTAVAIL); |