summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorMichael Scherer <misc@redhat.com>2017-02-22 22:47:02 +0100
committerJeff Darcy <jeff@pl.atyp.us>2017-05-04 15:25:46 +0000
commitd7cb404d9f75253b86b7a9263cab56ec853c5c94 (patch)
treea4f0154491cf0ec7f57eaa625c00450b29f2886f /xlators/storage
parent7c98143c7928f4ec936c90f0125b2a2aaf8f5174 (diff)
Refactor the code for posix_handle_pair
It was no longer compiling on Darwin, and triggered a cppcheck error: [xlators/storage/posix/src/posix-helpers.c:1097]: (error) Invalid number of character '{' when these macros are defined: 'GF_DARWIN_HOST_OS'. Change-Id: I986609cc6cfc13ddea0ed35d7776736171f40a41 BUG: 789278 Signed-off-by: Michael Scherer <misc@redhat.com> Reviewed-on: https://review.gluster.org/16729 Tested-by: Michael Scherer <misc@fedoraproject.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix-helpers.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index eef1546cc69..ae07b28e48a 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1148,6 +1148,11 @@ posix_handle_pair (xlator_t *this, const char *real_path,
{
int sys_ret = -1;
int ret = 0;
+#ifdef GF_DARWIN_HOST_OS
+ const int error_code = EINVAL;
+#else
+ const int error_code = EEXIST;
+#endif
if (XATTR_IS_PATHINFO (key)) {
ret = -EACCES;
@@ -1179,37 +1184,20 @@ posix_handle_pair (xlator_t *this, const char *real_path,
real_path);
}
} else {
-
-#ifdef GF_DARWIN_HOST_OS
- if (errno == EINVAL) {
- gf_msg_debug (this->name, 0, "%s: key:"
- "%s flags: %u length:%d "
- "error:%s", real_path,
- key, flags, value->len,
- strerror (errno));
- } else {
- gf_msg (this->name, GF_LOG_ERROR,
- errno, P_MSG_XATTR_FAILED,
- "%s: key:%s flags: "
- "%u length:%d",
- real_path, key, flags,
- value->len);
-
-#else /* ! DARWIN */
- if (errno == EEXIST)
+ if (errno == error_code) {
gf_msg_debug (this->name, 0,
"%s: key:%s"
"flags: %u length:%d",
real_path, key, flags,
value->len);
- else
+ } else {
gf_msg (this->name, GF_LOG_ERROR, errno,
P_MSG_XATTR_FAILED, "%s: key:%s"
"flags: %u length:%d",
real_path, key, flags,
value->len);
-#endif /* DARWIN */
}
+ }
goto out;
}