diff options
author | Charles Manning <cdhmanning@gmail.com> | 2011-04-13 10:20:06 +1200 |
---|---|---|
committer | Charles Manning <cdhmanning@gmail.com> | 2011-04-13 10:20:06 +1200 |
commit | 7715144e7d55b2854f907001c432348e4caa5954 (patch) | |
tree | 90865a354ece2b946672158dd561a79d0fafc1a4 /yaffs_nameval.c | |
parent | 2c98f380f6e28ef71d4d7a8a174cc22b0481f102 (diff) |
yaffs: Handle attribute size query correctly.
If getxattr() is passed a buffer size of zero then this is a size query.
Return the size of the attribute without copying it out.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
Diffstat (limited to 'yaffs_nameval.c')
-rw-r--r-- | yaffs_nameval.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/yaffs_nameval.c b/yaffs_nameval.c index e75411b..487b03e 100644 --- a/yaffs_nameval.c +++ b/yaffs_nameval.c @@ -146,6 +146,12 @@ int nval_get(const char *xb, int xb_size, const YCHAR * name, char *buf, pos++; size--; + /* If bsize is zero then this is a size query. + * Return the size, but don't copy. + */ + if (!bsize) + return size; + if (size <= bsize) { memcpy(buf, xb + pos, size); return size; |