mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 06:52:22 +03:00
test: add test for the non-resolving of chase_symlink() root prefix
This commit is contained in:
parent
c2595d3b02
commit
6efb1257d1
@ -371,6 +371,15 @@ static void test_chase_symlinks(void) {
|
||||
assert_se(streq("/usr", result));
|
||||
result = mfree(result);
|
||||
|
||||
/* Make sure that symlinks in the "root" path are not resolved, but those below are */
|
||||
p = strjoina("/etc/..", temp, "/self");
|
||||
assert_se(symlink(".", p) >= 0);
|
||||
q = strjoina(p, "/top/dot/dotdota");
|
||||
r = chase_symlinks(q, p, 0, &result, NULL);
|
||||
assert_se(r > 0);
|
||||
assert_se(path_equal(path_startswith(result, p), "usr"));
|
||||
result = mfree(result);
|
||||
|
||||
cleanup:
|
||||
assert_se(rm_rf(temp, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user