fix #6445: correctly set size when stat-ing symlinks
The size of a symlink should be the length of its target (name, not content), some tools like bsdtar seem to actually rely on this information for allocating buffers.. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Link: https://lore.proxmox.com/20250606085049.127928-1-f.gruenbichler@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c70839846a
commit
477678d517
1 changed files with 12 additions and 1 deletions
|
|
@ -55,8 +55,16 @@ static int cfs_plug_link_getattr(cfs_plug_t *plug, const char *path, struct stat
|
|||
|
||||
cfs_debug("enter cfs_plug_link_getattr %s", path);
|
||||
|
||||
int ret = -EACCES;
|
||||
|
||||
cfs_plug_link_t *lnk = (cfs_plug_link_t *)plug;
|
||||
if (!lnk->symlink) {
|
||||
goto ret;
|
||||
}
|
||||
|
||||
memset(stbuf, 0, sizeof(struct stat));
|
||||
|
||||
stbuf->st_size = strlen(lnk->symlink);
|
||||
if (cfs_is_quorate()) {
|
||||
stbuf->st_mode = S_IFLNK | 0777;
|
||||
} else {
|
||||
|
|
@ -65,7 +73,10 @@ static int cfs_plug_link_getattr(cfs_plug_t *plug, const char *path, struct stat
|
|||
|
||||
stbuf->st_nlink = 1;
|
||||
|
||||
return 0;
|
||||
ret = 0;
|
||||
|
||||
ret:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cfs_plug_link_readlink(cfs_plug_t *plug, const char *path, char *buf, size_t max) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue