From aa53bb583d2d01867a2db1d217001fc897e2b835 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 3 Dec 2009 16:10:17 +0000 Subject: fixing some warnings on 64bit machine. Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 408 (warning while building on 64bit machine..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=408 --- libglusterfs/src/logging.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 46b3ac5afc1..a006184ccd7 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); -- cgit