From 5a8b057f53847d5fe416962bc99a90001967cf34 Mon Sep 17 00:00:00 2001 From: Mohamed Ashiq Liyazudeen Date: Tue, 30 Jun 2015 14:47:22 +0530 Subject: libglusterfs removing strerror in logging Backport of http://review.gluster.org/11464 Cherry picked from 9384a824041aeef0e58644cc9fe71dc7fa13eb35 >Change-Id: I8a0f40834da1151ddaef6139af3782bc076df57e >BUG: 1194640 >Signed-off-by: Mohamed Ashiq Liyazudeen >Reviewed-on: http://review.gluster.org/11464 >Tested-by: Gluster Build System >Tested-by: NetBSD Build System >Reviewed-by: Pranith Kumar Karampuri Change-Id: I8a0f40834da1151ddaef6139af3782bc076df57e BUG: 1217722 Signed-off-by: Mohamed Ashiq Liyazudeen Reviewed-on: http://review.gluster.org/11727 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Pranith Kumar Karampuri --- libglusterfs/src/common-utils.c | 37 ++++++++++++------------------------- libglusterfs/src/common-utils.h | 3 +-- libglusterfs/src/fd.c | 5 ++--- libglusterfs/src/syncop.c | 6 ++---- 4 files changed, 17 insertions(+), 34 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 6a9e1a6ea65..2ac8cb7e457 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -97,7 +97,7 @@ mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks) ret = mkdir (dir, mode); if (ret && errno != EEXIST) { gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_DIR_OP_FAILED, - "Failed due to reason %s", strerror (errno)); + "Failed due to reason"); goto out; } @@ -203,15 +203,12 @@ gf_rev_dns_lookup (const char *ip) if (ret != 0) { gf_msg ("resolver", GF_LOG_INFO, errno, LG_MSG_RESOLVE_HOSTNAME_FAILED, "could not resolve " - "hostname for %s: %s", ip, strerror (errno)); + "hostname for %s", ip); goto out; } /* Get the FQDN */ fqdn = gf_strdup (host_addr); - if (!fqdn) - gf_msg ("resolver", GF_LOG_CRITICAL, 0, LG_MSG_NO_MEMORY, - "Allocation failed for the host address"); out: return fqdn; @@ -242,8 +239,6 @@ gf_resolve_path_parent (const char *path) /* dup the parameter, we don't want to modify it */ pathc = strdupa (path); if (!pathc) { - gf_msg (THIS->name, GF_LOG_CRITICAL, 0, LG_MSG_NO_MEMORY, - "Allocation failed for the parent"); goto out; } @@ -253,9 +248,6 @@ gf_resolve_path_parent (const char *path) goto out; parent = gf_strdup (tmp); - if (!parent) - gf_msg (THIS->name, GF_LOG_CRITICAL, 0, LG_MSG_NO_MEMORY, - "Allocation failed for the parent"); out: return parent; } @@ -1809,7 +1801,7 @@ get_checksum_for_path (char *path, uint32_t *checksum) if (fd == -1) { gf_msg (THIS->name, GF_LOG_ERROR, errno, LG_MSG_PATH_ERROR, - "Unable to open %s, errno: %d", path, errno); + "Unable to open %s", path); goto out; } @@ -1843,8 +1835,8 @@ get_file_mtime (const char *path, time_t *stamp) ret = stat (path, &f_stat); if (ret < 0) { gf_msg (THIS->name, GF_LOG_ERROR, errno, - LG_MSG_FILE_STAT_FAILED, "failed to stat %s: %s", - path, strerror (errno)); + LG_MSG_FILE_STAT_FAILED, "failed to stat %s", + path); goto out; } @@ -1905,15 +1897,13 @@ gf_is_ip_in_net (const char *network, const char *ip_str) ret = inet_pton (family, ip_str, &ip_buf); if (ret < 0) gf_msg ("common-utils", GF_LOG_ERROR, errno, - LG_MSG_INET_PTON_FAILED, "inet_pton() failed with %s", - strerror (errno)); + LG_MSG_INET_PTON_FAILED, "inet_pton() failed"); /* Convert network IP address to a long */ ret = inet_pton (family, net_ip, &net_ip_buf); if (ret < 0) { gf_msg ("common-utils", GF_LOG_ERROR, errno, - LG_MSG_INET_PTON_FAILED, "inet_pton() failed with %s", - strerror (errno)); + LG_MSG_INET_PTON_FAILED, "inet_pton() failed"); goto out; } @@ -2743,13 +2733,12 @@ generate_glusterfs_ctx_id (void) if (gettimeofday (&tv, NULL) == -1) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, LG_MSG_GETTIMEOFDAY_FAILED, "gettimeofday: " - "failed %s", strerror (errno)); + "failed"); } if (gethostname (hostname, 256) == -1) { gf_msg ("glusterfsd", GF_LOG_ERROR, errno, - LG_MSG_GETHOSTNAME_FAILED, "gethostname: failed %s", - strerror (errno)); + LG_MSG_GETHOSTNAME_FAILED, "gethostname: failed"); } gf_time_fmt (now_str, sizeof now_str, tv.tv_sec, gf_timefmt_Ymd_T); @@ -2784,7 +2773,7 @@ gf_get_reserved_ports () gf_msg ("glusterfs", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED, "could not open the file " "/proc/sys/net/ipv4/ip_local_reserved_ports for " - "getting reserved ports info (%s)", strerror (errno)); + "getting reserved ports info"); goto out; } @@ -2792,8 +2781,7 @@ gf_get_reserved_ports () if (ret < 0) { gf_msg ("glusterfs", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED, "could not read the file %s for" - " getting reserved ports info (%s)", proc_file, - strerror (errno)); + " getting reserved ports info", proc_file); goto out; } ports_info = gf_strdup (buffer); @@ -3396,8 +3384,7 @@ gf_is_service_running (char *pidfile, int *pid) ret = fscanf (file, "%d", pid); if (ret <= 0) { gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_FILE_OP_FAILED, - "Unable to read pidfile: %s, %s", pidfile, - strerror (errno)); + "Unable to read pidfile: %s", pidfile); *pid = -1; } diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 67728350508..9c197aa67e4 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -300,8 +300,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 remove internal " \ - "xattr: %s: %s", key, \ - strerror (op_errno)); \ + "xattr: %s", key); \ goto label; \ } \ } while (0) diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 85334bbf014..ea74d03b0a9 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -286,10 +286,9 @@ gf_fd_unused_get (fdtable_t *fdtable, fd_t *fdptr) error = gf_fd_fdtable_expand (fdtable, fdtable->max_fds + 1); if (error) { - gf_msg ("fd", GF_LOG_ERROR, 0, + gf_msg ("fd", GF_LOG_ERROR, error, LG_MSG_EXPAND_FD_TABLE_FAILED, - "Cannot expand fdtable: %s", - strerror (error)); + "Cannot expand fdtable"); goto out; } ++alloc_attempts; diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 019e8962598..cd60a1a444a 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -342,8 +342,7 @@ synctask_yield (struct synctask *task) } if (swapcontext (&task->ctx, &task->proc->sched) < 0) { gf_msg ("syncop", GF_LOG_ERROR, errno, - LG_MSG_SWAPCONTEXT_FAILED, "swapcontext failed (%s)", - strerror (errno)); + LG_MSG_SWAPCONTEXT_FAILED, "swapcontext failed"); } THIS = oldTHIS; @@ -495,8 +494,7 @@ synctask_create (struct syncenv *env, size_t stacksize, synctask_fn_t fn, if (getcontext (&newtask->ctx) < 0) { gf_msg ("syncop", GF_LOG_ERROR, errno, - LG_MSG_GETCONTEXT_FAILED, "getcontext failed (%s)", - strerror (errno)); + LG_MSG_GETCONTEXT_FAILED, "getcontext failed"); goto err; } -- cgit