diff options
Diffstat (limited to 'libglusterfs/src/compat.c')
| -rw-r--r-- | libglusterfs/src/compat.c | 60 | 
1 files changed, 26 insertions, 34 deletions
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c index a24f3aabd..42c20f527 100644 --- a/libglusterfs/src/compat.c +++ b/libglusterfs/src/compat.c @@ -40,10 +40,7 @@  #ifdef GF_SOLARIS_HOST_OS  int -solaris_fsetxattr(int fd, -                  const char* key, -                  const char *value, -                  size_t size, +solaris_fsetxattr(int fd, const char* key, const char *value, size_t size,                    int flags)  {          int attrfd = -1; @@ -67,10 +64,7 @@ solaris_fsetxattr(int fd,  int -solaris_fgetxattr(int fd, -                  const char* key, -                  char *value, -                  size_t size) +solaris_fgetxattr(int fd, const char* key, char *value, size_t size)  {          int attrfd = -1;          int ret = 0; @@ -86,12 +80,12 @@ solaris_fgetxattr(int fd,                  }                  close (attrfd);          } else { -                if (errno == ENOENT) -                        errno = ENODATA;                  if (errno != ENOENT) -                        gf_log ("libglusterfs", GF_LOG_DEBUG, +                        gf_log ("libglusterfs", GF_LOG_INFO,                                  "Couldn't read extended attribute for the file %d (%d)",                                  fd, errno); +                if (errno == ENOENT) +                        errno = ENODATA;                  return -1;          } @@ -219,11 +213,8 @@ out:  }  int -solaris_setxattr(const char *path, -                 const char* key, -                 const char *value, -                 size_t size, -                 int flags) +solaris_setxattr(const char *path, const char* key, const char *value, +                 size_t size, int flags)  {          int attrfd = -1;          int ret = 0; @@ -255,9 +246,7 @@ solaris_setxattr(const char *path,  int -solaris_listxattr(const char *path, -                  char *list, -                  size_t size) +solaris_listxattr(const char *path, char *list, size_t size)  {          int attrdirfd = -1;          ssize_t len = 0; @@ -279,15 +268,18 @@ solaris_listxattr(const char *path,                  if (dirptr) {                          while ((dent = readdir(dirptr))) {                                  size_t listlen = strlen(dent->d_name); -                                if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) { +                                if (!strcmp(dent->d_name, ".") || +                                    !strcmp(dent->d_name, "..")) {                                          /* we don't want "." and ".." here */                                          continue;                                  }                                  if (size == 0) { -                                        /* return the current size of the list of extended attribute names*/ +                                        /* return the current size of the list +                                           of extended attribute names*/                                          len += listlen + 1;                                  } else { -                                        /* check size and copy entrie + nul into list. */ +                                        /* check size and copy entry + null +                                           into list. */                                          if ((len + listlen + 1) > size) {                                                  errno = ERANGE;                                                  len = -1; @@ -321,9 +313,7 @@ out:  int -solaris_flistxattr(int fd, -                   char *list, -                   size_t size) +solaris_flistxattr(int fd, char *list, size_t size)  {          int attrdirfd = -1;          ssize_t len = 0; @@ -338,15 +328,18 @@ solaris_flistxattr(int fd,                  if (dirptr) {                          while ((dent = readdir(dirptr))) {                                  size_t listlen = strlen(dent->d_name); -                                if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) { +                                if (!strcmp(dent->d_name, ".") || +                                    !strcmp(dent->d_name, "..")) {                                          /* we don't want "." and ".." here */                                          continue;                                  }                                  if (size == 0) { -                                        /* return the current size of the list of extended attribute names*/ +                                        /* return the current size of the list +                                           of extended attribute names*/                                          len += listlen + 1;                                  } else { -                                        /* check size and copy entrie + nul into list. */ +                                        /* check size and copy entry + null +                                           into list. */                                          if ((len + listlen + 1) > size) {                                                  errno = ERANGE;                                                  len = -1; @@ -375,8 +368,7 @@ solaris_flistxattr(int fd,  int -solaris_removexattr(const char *path, -                    const char* key) +solaris_removexattr(const char *path, const char* key)  {          int ret = -1;          int attrfd = -1; @@ -430,12 +422,12 @@ solaris_getxattr(const char *path,                  }                  close (attrfd);          } else { +                if (errno != ENOENT) +                        gf_log ("libglusterfs", GF_LOG_INFO, +                                "Couldn't read extended attribute for the file %s (%s)", +                                path, strerror (errno));                  if (errno == ENOENT)                          errno = ENODATA; -                if (errno != ENOENT) -                        gf_log ("libglusterfs", GF_LOG_DEBUG, -                                "Couldn't read extended attribute for the file %s (%d)", -                                path, errno);                  ret = -1;          }          if (mapped_path)  | 
