mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-08-03 18:05:58 -04:00
fuse-overlayfs: on link(2) set the redirect link from the source
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
5c3e2c330b
commit
b78f52f24b
14
main.c
14
main.c
@ -2105,6 +2105,20 @@ ovl_link (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, const char *newn
|
|||||||
int dfd = TEMP_FAILURE_RETRY (openat (node_dirfd (newparentnode), path, O_WRONLY));
|
int dfd = TEMP_FAILURE_RETRY (openat (node_dirfd (newparentnode), path, O_WRONLY));
|
||||||
if (dfd >= 0)
|
if (dfd >= 0)
|
||||||
{
|
{
|
||||||
|
bool set = false;
|
||||||
|
int sfd = TEMP_FAILURE_RETRY (openat (node_dirfd (node), node->path, O_RDONLY));
|
||||||
|
if (sfd >= 0)
|
||||||
|
{
|
||||||
|
char redirect_path[PATH_MAX + 10];
|
||||||
|
ssize_t s = fgetxattr (sfd, REDIRECT_XATTR, redirect_path, sizeof (redirect_path));
|
||||||
|
if (s > 0)
|
||||||
|
{
|
||||||
|
set = fsetxattr (dfd, REDIRECT_XATTR, redirect_path, s, 0) == 0;
|
||||||
|
}
|
||||||
|
close (sfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! set)
|
||||||
fsetxattr (dfd, REDIRECT_XATTR, node->path, strlen (node->path), 0);
|
fsetxattr (dfd, REDIRECT_XATTR, node->path, strlen (node->path), 0);
|
||||||
close (dfd);
|
close (dfd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user