diff options
author | 3chas3 <ciwillia@brocade.com> | 2017-01-31 08:21:15 -0500 |
---|---|---|
committer | Evgeny Vereshchagin <evvers@ya.ru> | 2017-01-31 16:21:15 +0300 |
commit | 877777d77690d741c93404fd176da7f5327c2878 (patch) | |
tree | 75e18d58b098d1217dcdba31abbe4fe435c95c8f /src/test | |
parent | ef1fd941f9e7c87809b28bbcd6d82f74ba4ed660 (diff) |
util-lib: Fix chase_symlinks() with absolute symlinks (#5185)
If chase_symlinks() encouters an absolute symlink, it resets the todo
buffer to just the newly discovered symlink and discards any of the
remaining previous symlink path. Regardless of whether or not the
symlink is absolute or relative, we need to preserve the remainder of
the path that has not yet been resolved.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-fs-util.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index ae68587be9..4cb465d0d2 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -186,6 +186,13 @@ static void test_chase_symlinks(void) { r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result); assert_se(r == -ENOENT); + p = strjoina(temp, "/target"); + q = strjoina(temp, "/top"); + assert_se(symlink(q, p) >= 0); + p = strjoina(temp, "/target/idontexist"); + r = chase_symlinks(p, NULL, 0, &result); + assert_se(r == -ENOENT); + assert_se(rm_rf(temp, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0); } |