Symlinks that have an absolute path are not getting
properly dereferenced in path_walk() due to a bug
with the cur and next inode pointers, and because
the path position wasn't getting reset on the symlink
dereference.
Signed-off-by: Sam Lang <sam.lang@inktank.com>
if (i == path.depth() - 1 && followsym &&
next && next->is_symlink()) {
// resolve symlink
- if (cur->symlink[0] == '/') {
+ if (next->symlink[0] == '/') {
path = next->symlink.c_str();
next = root;
+ // reset position - will get incremented to 0
+ i = -1;
} else {
filepath more(next->symlink.c_str());
// we need to remove the symlink component from off of the path
filepath path(relpath);
Inode *in;
- int r = path_walk(path, &in);
+ int r = path_walk(path, &in, false);
if (r < 0)
return r;