main: correctly read inode for unix sockets

correctly read the inode when processing a UNIX socket.

regression introduced by b25bbde64dc5d06373e087d7fae6367acf1fd09e.

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

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
This commit is contained in:
Giuseppe Scrivano 2019-08-25 23:04:23 +02:00
parent 43b641d7f2
commit 7251f20c4b
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772
2 changed files with 3 additions and 2 deletions

3
main.c
View File

@ -1348,8 +1348,7 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
cleanup_close int fd = TEMP_FAILURE_RETRY (openat (it->fd, npath, O_RDONLY|O_NONBLOCK|O_NOFOLLOW));
if (fd < 0)
{
/* It is a symlink, read only the ino. */
if (errno == ELOOP && fstatat (it->fd, npath, &st, AT_SYMLINK_NOFOLLOW) == 0)
if (errno != EPERM && fstatat (it->fd, npath, &st, AT_SYMLINK_NOFOLLOW) == 0)
{
ret->tmp_ino = st.st_ino;
mode = st.st_mode;

View File

@ -47,6 +47,8 @@ docker run --rm -ti -v $(pwd)/merged:/merged centos:6 yum --installroot /merged
mkdir merged/a-directory
python -c 'import socket; socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM).bind("merged/unix-socket")'
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