mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-19 12:15:48 -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)
|
direct_listxattr (struct ovl_layer *l, const char *path, char *buf, size_t size)
|
||||||
{
|
{
|
||||||
char full_path[PATH_MAX];
|
char full_path[PATH_MAX];
|
||||||
|
int ret;
|
||||||
strconcat3 (full_path, PATH_MAX, l->path, "/", path);
|
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);
|
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)
|
direct_getxattr (struct ovl_layer *l, const char *path, const char *name, char *buf, size_t size)
|
||||||
{
|
{
|
||||||
char full_path[PATH_MAX];
|
char full_path[PATH_MAX];
|
||||||
|
int ret;
|
||||||
strconcat3 (full_path, PATH_MAX, l->path, "/", path);
|
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);
|
return lgetxattr (full_path, name, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user