main: if the path is a dir, work on the proc path

when reading xattr, if the path cannot be open as it is a directory,
operate on the /proc/fd/FD path.

Closes: https://github.com/containers/fuse-overlayfs/issues/104

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
This commit is contained in:
Giuseppe Scrivano 2019-08-15 21:51:22 +02:00
parent c756bbe9e7
commit 08136d8826
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772
2 changed files with 7 additions and 1 deletions

2
main.c
View File

@ -554,7 +554,7 @@ open_fd_or_get_path (struct ovl_data *lo, struct ovl_node *n, char *path, int *f
path[0] = '\0';
*fd = TEMP_FAILURE_RETRY (openat (node_dirfd (n), n->path, O_NONBLOCK|O_NOFOLLOW|mode));
if (*fd < 0 && errno == ELOOP)
if (*fd < 0 && (errno == ELOOP || errno == EISDIR))
{
get_node_path (lo, n, path);
return 0;

View File

@ -45,5 +45,11 @@ fuse-overlayfs -o fast_ino_check=1,sync=0,lowerdir=lower,upperdir=upper,workdir=
docker run --rm -ti -v $(pwd)/merged:/merged centos:6 yum --installroot /merged -y --releasever 6 install nano
mkdir merged/a-directory
setfattr -n user.foo -v bar merged/a-directory
getfattr -d merged/a-directory | grep bar
getfattr --only-values -n user.foo merged/a-directory | grep bar
getfattr --only-values -n user.foo upper/a-directory | grep bar
umount merged