diff options
-rw-r--r-- | booster/src/booster.c | 19 | ||||
-rw-r--r-- | libglusterfs/src/logging.c | 28 | ||||
-rw-r--r-- | xlators/features/locks/src/common.c | 2 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-protocol.c | 2 |
4 files changed, 28 insertions, 23 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index 338d6db73..450f24c6b 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -814,7 +814,8 @@ write (int fd, const void *buf, size_t count) int ret; glusterfs_file_t glfs_fd = 0; - gf_log ("booster", GF_LOG_TRACE, "write: fd %d, count %d", fd, count); + gf_log ("booster", GF_LOG_TRACE, "write: fd %d, count %"GF_PRI_SIZET, + fd, count); glfs_fd = booster_fdptr_get (booster_fdtable, fd); @@ -866,8 +867,8 @@ pwrite (int fd, const void *buf, size_t count, unsigned long offset) int ret; glusterfs_file_t glfs_fd = 0; - gf_log ("booster", GF_LOG_TRACE, "pwrite: fd %d, count %d, offset %lu", - fd, count, offset); + gf_log ("booster", GF_LOG_TRACE, "pwrite: fd %d, count %"GF_PRI_SIZET + ", offset %lu", fd, count, offset); glfs_fd = booster_fdptr_get (booster_fdtable, fd); if (!glfs_fd) { @@ -893,10 +894,10 @@ pwrite64 (int fd, const void *buf, size_t count, uint64_t offset) int ret; glusterfs_file_t glfs_fd = 0; - gf_log ("booster", GF_LOG_TRACE, "pwrite64: fd %d, count %d, offset %" - PRIu64, fd, count, offset); + gf_log ("booster", GF_LOG_TRACE, "pwrite64: fd %d, count %"GF_PRI_SIZET + ", offset %"PRIu64, fd, count, offset); glfs_fd = booster_fdptr_get (booster_fdtable, fd); - + if (!glfs_fd) { gf_log ("booster", GF_LOG_TRACE, "Not a booster fd"); if (real_pwrite64 == NULL) { @@ -2611,7 +2612,8 @@ sendfile (int out_fd, int in_fd, off_t *offset, size_t count) ssize_t ret = -1; gf_log ("booster", GF_LOG_TRACE, "sendfile: in fd %d, out fd %d, offset" - " %"PRIu64", count %d", in_fd, out_fd, *offset, count); + " %"PRIu64", count %"GF_PRI_SIZET, in_fd, out_fd, *offset, + count); /* * handle sendfile in booster only if in_fd corresponds to a glusterfs * file handle @@ -2641,7 +2643,8 @@ sendfile64 (int out_fd, int in_fd, off_t *offset, size_t count) ssize_t ret = -1; gf_log ("booster", GF_LOG_TRACE, "sendfile64: in fd %d, out fd %d," - " offset %"PRIu64", count %d", in_fd, out_fd, *offset, count); + " offset %"PRIu64", count %"GF_PRI_SIZET, in_fd, out_fd, + *offset, count); /* * handle sendfile in booster only if in_fd corresponds to a glusterfs * file handle diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 46b3ac5af..a006184cc 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -429,9 +429,11 @@ _gf_log (const char *domain, const char *file, const char *function, int line, struct tm *tm = NULL; char timestr[256]; - char *str1, *str2, *msg; - size_t len = 0; - int ret = 0; + char *str1 = NULL; + char *str2 = NULL; + char *msg = NULL; + size_t len = 0; + int ret = 0; static char *level_strings[] = {"", /* NONE */ "C", /* CRITICAL */ @@ -516,18 +518,18 @@ log: unlock: pthread_mutex_unlock (&logfile_mutex); - if ((ret != -1) && __central_log_enabled && - ((glusterfs_central_log_flag_get ()) == 0)) { - - glusterfs_central_log_flag_set (); - { - gf_log_central (msg); - } - glusterfs_central_log_flag_unset (); - } + if (msg) { + if ((ret != -1) && __central_log_enabled && + ((glusterfs_central_log_flag_get ()) == 0)) { - if (msg) + glusterfs_central_log_flag_set (); + { + gf_log_central (msg); + } + glusterfs_central_log_flag_unset (); + } FREE (msg); + } if (str1) FREE (str1); diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index 5c83f366e..7cbf45958 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -264,7 +264,7 @@ pl_print_verdict (char *str, int size, int op_ret, int op_errno) } } - snprintf (str, size, verdict); + snprintf (str, size, "%s", verdict); } diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 9dc6e1184..1f2cb7d06 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -234,7 +234,7 @@ server_print_reply (call_frame_t *frame, int op_ret, int op_errno) fdstr[0] = '\0'; if (state->fd) - snprintf (fdstr, 128, " fd=%p", state->fd); + snprintf (fdstr, 32, " fd=%p", state->fd); gf_log (this->name, GF_LOG_NORMAL, "%s%s => (%d, %d)%s", |