diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-01-09 12:29:12 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-03-06 13:42:43 +0100 |
commit | e864dfa6717fd63d290b867f44bd1c6d661a9047 (patch) | |
tree | 362ec7bd854fe660385c81c2d06f6d7ead00132b /src/test | |
parent | chase-symlinks: Add CHASE_PARENT (diff) | |
download | systemd-e864dfa6717fd63d290b867f44bd1c6d661a9047.tar.xz systemd-e864dfa6717fd63d290b867f44bd1c6d661a9047.zip |
chase-symlinks: Add CHASE_MKDIR_0755
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-fs-util.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index 97b6bdabc8..ef7f41885a 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -486,6 +486,20 @@ TEST(chase_symlinks_at) { assert_se(chase_symlinks_at(tfd, "chase", CHASE_NONEXISTENT|CHASE_PARENT, &result, NULL) >= 0); assert_se(streq(result, ".")); result = mfree(result); + + /* Test CHASE_MKDIR_0755 */ + + assert_se(chase_symlinks_at(tfd, "m/k/d/i/r", CHASE_MKDIR_0755, &result, NULL) >= 0); + assert_se(faccessat(tfd, "m/k/d/i/r", F_OK, 0) >= 0); + assert_se(streq(result, "m/k/d/i/r")); + result = mfree(result); + + assert_se(chase_symlinks_at(tfd, "m/../q", CHASE_MKDIR_0755, &result, NULL) >= 0); + assert_se(faccessat(tfd, "q", F_OK, 0) >= 0); + assert_se(streq(result, "q")); + result = mfree(result); + + assert_se(chase_symlinks_at(tfd, "i/../p", CHASE_MKDIR_0755, NULL, NULL) == -ENOENT); } TEST(unlink_noerrno) { |