lkml.org 
[lkml]   [2012]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: st_size of a symlink
On Tue, 2012-07-24 at 00:07:48 +0200, Richard Weinberger wrote:
> On 23.07.2012 22:47, Jesper Juhl wrote:
> >>Fix it _how_?
> >
> >By returning the size as the number of bytes in the name the link is
> >currently pointing at.
>
> This is not easy.
> procfs has no clue where the link pointing at.
> The information is generated while accessing the link.
> tmpfs on the other hand has this information because symlinks get
> only changed through tmpfs...

Well, can't the link be accessed when getting the stat information
then?

> >> By retrying readlink() with bigger buffer.
> >>With procfs there's just a few more ways the readlink() output can
> >>change, that's all.
> >>
> >Still not a good reason to just return 0 IMHO.
>
> IMHO the lstat() and readlink() manpages have to be more precise
> about st_size.

They document what POSIX says:

<http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html>

regards,
guillem


\
 
 \ /
  Last update: 2012-07-24 01:41    [W:0.137 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site