diff options
author | Mohamed Ashiq Liyazudeen <mliyazud@redhat.com> | 2015-06-25 12:52:57 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-06-26 21:47:08 -0700 |
commit | 43aea2da863d94079dbf4dfceabee41a0be67ef7 (patch) | |
tree | 770d4fb7e2c156565e67ee612f44e7c6a41b774b /libglusterfs | |
parent | 06d5085f8ab222c10df1980ca23919c0e34284a1 (diff) |
common-utils/libglusterfs : removing strerror to avoid duplicate printing of error message
Change-Id: I0a1c99ae7a2efc657e3465b21dd238e725ae236c
BUG: 1194640
Signed-off-by: Mohamed Ashiq Liyazudeen <mliyazud@redhat.com>
Reviewed-on: http://review.gluster.org/11400
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 30 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 3 |
2 files changed, 14 insertions, 19 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index f013f93ee1e..8ee05cef56b 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -115,10 +115,12 @@ mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks) ret = stat (dir, &stbuf); if (ret || !S_ISDIR (stbuf.st_mode)) { + if (ret == 0) + errno = 0; ret = -1; - gf_msg ("", GF_LOG_ERROR, 0, LG_MSG_DIR_OP_FAILED, "Failed to " - "create directory, possibly some of the components " - "were not directories"); + gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_DIR_OP_FAILED, "Failed" + " to create directory, possibly some of the components" + " were not directories"); goto out; } @@ -299,12 +301,10 @@ gf_resolve_ip6 (const char *hostname, ret = gf_asprintf (&port_str, "%d", port); if (-1 == ret) { - gf_msg ("resolver", GF_LOG_ERROR, 0, - LG_MSG_ASPRINTF_FAILED, "asprintf failed"); return -1; } if ((ret = getaddrinfo(hostname, port_str, &hints, &cache->first)) != 0) { - gf_msg ("resolver", GF_LOG_ERROR, ret, + gf_msg ("resolver", GF_LOG_ERROR, 0, LG_MSG_GETADDRINFO_FAILED, "getaddrinfo failed" " (%s)", gai_strerror (ret)); @@ -3132,8 +3132,7 @@ gf_is_local_addr (char *hostname) ret = getaddrinfo (hostname, NULL, NULL, &result); if (ret != 0) { - gf_msg (this->name, GF_LOG_ERROR, ret, - LG_MSG_GETADDRINFO_FAILED, + gf_msg (this->name, GF_LOG_ERROR, 0, LG_MSG_GETADDRINFO_FAILED, "error in getaddrinfo: %s\n", gai_strerror(ret)); goto out; } @@ -3173,17 +3172,15 @@ gf_is_same_address (char *name1, char *name2) gai_err = getaddrinfo(name1,NULL,NULL,&addr1); if (gai_err != 0) { - gf_msg (name1, GF_LOG_WARNING, gai_err, - LG_MSG_GETADDRINFO_FAILED, "error in getaddrinfo: " - "%s\n", gai_strerror(gai_err)); + gf_msg (name1, GF_LOG_WARNING, 0, LG_MSG_GETADDRINFO_FAILED, + "error in getaddrinfo: %s\n", gai_strerror(gai_err)); goto out; } gai_err = getaddrinfo(name2,NULL,NULL,&addr2); if (gai_err != 0) { - gf_msg (name2, GF_LOG_WARNING, gai_err, - LG_MSG_GETADDRINFO_FAILED, "error in getaddrinfo: " - "%s\n", gai_strerror(gai_err)); + gf_msg (name2, GF_LOG_WARNING, 0, LG_MSG_GETADDRINFO_FAILED, + "error in getaddrinfo: %s\n", gai_strerror(gai_err)); goto out; } @@ -3527,8 +3524,7 @@ gf_set_timestamp (const char *src, const char* dest) ret = stat (src, &sb); if (ret) { gf_msg (this->name, GF_LOG_ERROR, errno, - LG_MSG_FILE_STAT_FAILED, "stat on %s failed: %s", - src, strerror(errno)); + LG_MSG_FILE_STAT_FAILED, "stat on %s", src); goto out; } new_time[0].tv_sec = sb.st_atime; @@ -3544,7 +3540,7 @@ gf_set_timestamp (const char *src, const char* dest) ret = utimes (dest, new_time); if (ret) { gf_msg (this->name, GF_LOG_ERROR, errno, LG_MSG_UTIMES_FAILED, - "utimes on %s failed: %s", dest, strerror(errno)); + "utimes on %s", dest); } out: return ret; diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index cdd5e45c3e2..86ea42ee849 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -276,8 +276,7 @@ int gf_set_log_ident (cmd_args_t *cmd_args); gf_msg (this->name, GF_LOG_ERROR, op_errno, \ LG_MSG_NO_PERM, \ "attempt to set internal" \ - " xattr: %s: %s", pattern, \ - strerror (op_errno)); \ + " xattr: %s", pattern); \ goto label; \ } \ } while (0) |