Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix following issues in Solaris port:

    coredump when non-existent file specified
    list() function does not work in solaris.
  • Loading branch information...
commit 312798bd94dd20ce1975599b84ef8ff2285ab1ce 1 parent 60e8bea
Super-User authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 xattr/_xattr.c
View
17 xattr/_xattr.c
@@ -387,14 +387,19 @@ static ssize_t xattr_xflistxattr(int xfd, char *namebuf, size_t size, int option
ssize_t nsize = 0;
dirp = fdopendir(xfd);
+ if (dirp == NULL) {
+ return (-1);
+ }
while (entry = readdir(dirp)) {
- esize = strlen(entry->d_name);
- if (nsize + esize + 1 < size) {
- strcat(namebuf + nsize, entry->d_name);
+ if (strcmp(entry->d_name, ".") == 0 ||
+ strcmp(entry->d_name, "..") == 0)
+ continue;
+ esize = strlen(entry->d_name);
+ if (nsize + esize + 1 <= size) {
+ snprintf((char *)(namebuf + nsize), esize + 1,
+ entry->d_name);
+ }
nsize += esize + 1; /* +1 for \0 */
- } else {
- break;
- }
}
closedir(dirp);
return nsize;
Please sign in to comment.
Something went wrong with that request. Please try again.