From fc63f24904b14aaad338aa44107cbda7e547e6b1 Mon Sep 17 00:00:00 2001 From: Sachidananda Date: Fri, 11 Feb 2011 02:08:55 +0000 Subject: Check correct variable after function call. And some white space cleanups. Signed-off-by: Sachidananda Urs Signed-off-by: Anand V. Avati BUG: 2410 (Wrong variable checked after a function call) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2410 --- libglusterfs/src/logging.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 5b89aafb490..78bd1d6103f 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -172,14 +172,14 @@ struct _log_msg { -void +void gf_log_lock (void) { pthread_mutex_lock (&logfile_mutex); } -void +void gf_log_unlock (void) { pthread_mutex_unlock (&logfile_mutex); @@ -413,7 +413,7 @@ log: { va_start (ap, fmt); - strftime (timestr, 256, "%Y-%m-%d %H:%M:%S", tm); + strftime (timestr, 256, "%Y-%m-%d %H:%M:%S", tm); snprintf (timestr + strlen (timestr), 256 - strlen (timestr), ".%"GF_PRI_SUSECONDS, tv.tv_usec); @@ -505,7 +505,7 @@ client_log_init (struct _client_log *cl, char *identifier) } cl->file = fopen (path, "a"); GF_FREE (path); - + INIT_LIST_HEAD (&cl->list); } @@ -560,17 +560,17 @@ gf_log_from_client (const char *msg, char *identifier) } int -gf_cmd_log_init (const char *filename) +gf_cmd_log_init (const char *filename) { if (!filename){ - gf_log ("glusterd",GF_LOG_CRITICAL, "gf_cmd_log_init: no " + gf_log ("glusterd", GF_LOG_CRITICAL, "gf_cmd_log_init: no " "filename specified\n"); return -1; } cmd_log_filename = gf_strdup (filename); - if (!filename) { - gf_log ("glusterd",GF_LOG_CRITICAL, "gf_cmd_log_init: strdup" + if (!cmd_log_filename) { + gf_log ("glusterd", GF_LOG_CRITICAL, "gf_cmd_log_init: strdup" " error\n"); return -1; } @@ -653,5 +653,4 @@ out: FREE (str2); return (0); - } -- cgit WARNING, "failed to process line"); add_history (line); } state->rl_processing = 0; } int cli_rl_stdin (int fd, int idx, void *data, int poll_out, int poll_in, int poll_err) { rl_callback_read_char (); return 0; } char * cli_rl_autocomplete_entry (const char *text, int times) { struct cli_state *state = NULL; char *retp = NULL; state = global_state; if (!state->matchesp) return NULL; retp = *state->matchesp; state->matchesp++; return retp ? strdup (retp) : NULL; } int cli_rl_token_count (const char *text) { int count = 0; const char *trav = NULL; int is_spc = 1; for (trav = text; *trav; trav++) { if (*trav == ' ') { is_spc = 1; } else { if (is_spc) { count++; is_spc = 0; } } } if (is_spc) /* what needs to be autocompleted is a full new word, and not extend the last word */ count++; return count; } char ** cli_rl_tokenize (const char *text) { i