mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-18 11:46:18 -04:00
Merge pull request #366 from giuseppe/use-proc-read-xattrs
direct: use /proc/self/fd to read xattrs
This commit is contained in:
commit
f87e1781a8
19
direct.c
19
direct.c
@ -44,8 +44,13 @@ static int
|
||||
direct_listxattr (struct ovl_layer *l, const char *path, char *buf, size_t size)
|
||||
{
|
||||
char full_path[PATH_MAX];
|
||||
|
||||
strconcat3 (full_path, PATH_MAX, l->path, "/", path);
|
||||
int ret;
|
||||
ret = snprintf (full_path, sizeof (full_path), "/proc/self/fd/%d/%s", l->fd, path);
|
||||
if (ret >= sizeof (full_path))
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return llistxattr (full_path, buf, size);
|
||||
}
|
||||
@ -54,9 +59,13 @@ static int
|
||||
direct_getxattr (struct ovl_layer *l, const char *path, const char *name, char *buf, size_t size)
|
||||
{
|
||||
char full_path[PATH_MAX];
|
||||
|
||||
strconcat3 (full_path, PATH_MAX, l->path, "/", path);
|
||||
|
||||
int ret;
|
||||
ret = snprintf (full_path, sizeof (full_path), "/proc/self/fd/%d/%s", l->fd, path);
|
||||
if (ret >= sizeof (full_path))
|
||||
{
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
return lgetxattr (full_path, name, buf, size);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user