mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-15 10:21:19 -04:00
fuse-overlayfs: read correctly inode for dangling symlinks
do not follow symlinks when stat'ing a path, so that we read the inode of the symlink itself. Closes: https://github.com/containers/fuse-overlayfs/issues/23 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
50c7a50240
commit
a289a24acc
7
main.c
7
main.c
@ -765,13 +765,18 @@ make_ovl_node (const char *path, struct ovl_layer *layer, const char *name, ino_
|
|||||||
for (it = layer; it; it = it->next)
|
for (it = layer; it; it = it->next)
|
||||||
{
|
{
|
||||||
ssize_t s;
|
ssize_t s;
|
||||||
int fd = TEMP_FAILURE_RETRY (openat (it->fd, path, O_RDONLY|O_NONBLOCK));
|
int fd = TEMP_FAILURE_RETRY (openat (it->fd, path, O_RDONLY|O_NONBLOCK|O_NOFOLLOW|O_PATH));
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fstat (fd, &st) == 0)
|
if (fstat (fd, &st) == 0)
|
||||||
ret->ino = st.st_ino;
|
ret->ino = st.st_ino;
|
||||||
|
|
||||||
|
close (fd);
|
||||||
|
|
||||||
|
fd = TEMP_FAILURE_RETRY (openat (it->fd, path, O_RDONLY|O_NONBLOCK|O_NOFOLLOW));
|
||||||
|
if (fd < 0)
|
||||||
|
continue;
|
||||||
s = fgetxattr (fd, PRIVILEGED_ORIGIN_XATTR, path, sizeof (path) - 1);
|
s = fgetxattr (fd, PRIVILEGED_ORIGIN_XATTR, path, sizeof (path) - 1);
|
||||||
if (s > 0)
|
if (s > 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user