Re: [Yaffs] [PATCH] yaffs: fix getxattr support

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] [PATCH] yaffs: fix getxattr support
On Wednesday 13 April 2011 07:37:46 Stephen Smalley wrote:
> When passed a buffer size of 0, getxattr(2) is documented to return the
> size of the attribute value. However, yaffs returns -ERANGE instead.
> This breaks e.g. SELinux usage of getxattr. Fix yaffs to return the
> attribute size in this case.
>
> Signed-off-by: Stephen Smalley <>
>
> ---
>
>  yaffs_nameval.c |    3 +++
>  1 file changed, 3 insertions(+)

>
> diff --git a/yaffs_nameval.c b/yaffs_nameval.c
> index e75411b..727b644 100644
> --- a/yaffs_nameval.c
> +++ b/yaffs_nameval.c
> @@ -146,6 +146,9 @@ int nval_get(const char *xb, int xb_size, const
> YCHAR * name, char *buf,
>          pos++;
>          size--;

>
> +        if (!bsize)
> +            return size;
> +
>          if (size <= bsize) {
>              memcpy(buf, xb + pos, size);
>              return size;


This is in git:
http://yaffs.net/gitweb?p=yaffs2/.git;a=commit;h=7715144e7d55b2854f907001c432348e4caa5954

Thanks

Charles