diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-01-30 01:35:33 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-01-30 01:35:33 +0000 |
commit | 9ee0565d98150b76fe4871a3e1342fa598000f2a (patch) | |
tree | 393bf7839067ce8375baa995f6394cb3a9c92d20 | |
parent | 9017e316e2ef833d3b49c99ff9e6df70efc9ca44 (diff) | |
download | attr-9ee0565d98150b76fe4871a3e1342fa598000f2a.tar.gz |
Really fixed attribute listing
-rw-r--r-- | libattr/solaris.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libattr/solaris.c b/libattr/solaris.c index f5e4426..2b80126 100644 --- a/libattr/solaris.c +++ b/libattr/solaris.c @@ -121,14 +121,18 @@ __fflistxattr (int xfd, char *list, size_t size) continue; } + /* if size == 0 we calculate the size of a buffer + * which is sufficiently large to hold the list of names + */ + if (size == 0) { + rv += strlen(de->d_name) + 1; + continue; + } + /* Define __EXTENSIONS__ for strlcpy() */ /* http://www.gratisoft.us/todd/papers/strlcpy.html */ l = strlcpy(list, de->d_name, size); - - /* if size == 0 we effectively calculate the size of - * a buffer which is sufficiently large to hold the list of names - */ - if ((l >= size) && (size > 0)) { + if (l >= size) { errno = ERANGE; rv = -1; break; |