summaryrefslogtreecommitdiff
path: root/libattr/solaris.c
diff options
context:
space:
mode:
Diffstat (limited to 'libattr/solaris.c')
-rw-r--r--libattr/solaris.c14
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;