diff options
author | Amar Tumballi <amar@gluster.com> | 2009-07-17 22:42:10 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-07-20 14:28:57 -0700 |
commit | ca859dfe78e3da853181e5e9e314586bf9300204 (patch) | |
tree | 8c418bf125da6b3b9b00f053f6be1ee61d32bf82 /glusterfsd | |
parent | 632cce5e720acaa28ab680a6850f2aa8289d4628 (diff) |
fix build warnings in glusterfsd
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 130 (build warnings)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=130
Diffstat (limited to 'glusterfsd')
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index d8c693ff43b..6f976bacb40 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -951,10 +951,11 @@ gf_get_process_mode (char *exec_name) return ret; } -void +int set_log_file_path (cmd_args_t *cmd_args) { int i = 0; + int ret = 0; int port = 0; char *tmp_ptr = NULL; char tmp_str[1024] = {0,}; @@ -965,10 +966,13 @@ set_log_file_path (cmd_args_t *cmd_args) if (cmd_args->mount_point[i] == '/') tmp_str[i-1] = '-'; } - asprintf (&cmd_args->log_file, - DEFAULT_LOG_FILE_DIRECTORY "/%s.log", - tmp_str); - + ret = asprintf (&cmd_args->log_file, + DEFAULT_LOG_FILE_DIRECTORY "/%s.log", + tmp_str); + if (-1 == ret) { + gf_log ("glusterfsd", GF_LOG_ERROR, + "asprintf failed while setting up log-file"); + } goto done; } @@ -978,10 +982,13 @@ set_log_file_path (cmd_args_t *cmd_args) if (cmd_args->volume_file[i] == '/') tmp_str[i] = '-'; } - asprintf (&cmd_args->log_file, - DEFAULT_LOG_FILE_DIRECTORY "/%s.log", - tmp_str); - + ret = asprintf (&cmd_args->log_file, + DEFAULT_LOG_FILE_DIRECTORY "/%s.log", + tmp_str); + if (-1 == ret) { + gf_log ("glusterfsd", GF_LOG_ERROR, + "asprintf failed while setting up log-file"); + } goto done; } @@ -994,13 +1001,16 @@ set_log_file_path (cmd_args_t *cmd_args) if (cmd_args->volfile_id) tmp_ptr = cmd_args->volfile_id; - asprintf (&cmd_args->log_file, - DEFAULT_LOG_FILE_DIRECTORY "/%s-%s-%d.log", - cmd_args->volfile_server, tmp_ptr, port); + ret = asprintf (&cmd_args->log_file, + DEFAULT_LOG_FILE_DIRECTORY "/%s-%s-%d.log", + cmd_args->volfile_server, tmp_ptr, port); + if (-1 == ret) { + gf_log ("glusterfsd", GF_LOG_ERROR, + "asprintf failed while setting up log-file"); + } } - done: - return; + return ret; } int @@ -1056,11 +1066,17 @@ main (int argc, char *argv[]) cmd_args->volume_file = strdup (DEFAULT_CLIENT_VOLUME_FILE); } - if (cmd_args->log_file == NULL) - set_log_file_path (cmd_args); + if (cmd_args->log_file == NULL) { + ret = set_log_file_path (cmd_args); + if (-1 == ret) { + fprintf (stderr, "failed to set the log file path.. " + "exiting\n"); + return -1; + } + } - ctx->page_size = 128 * 1024; - ctx->iobuf_pool = iobuf_pool_new (8 * 1048576, ctx->page_size + 4096); + ctx->page_size = 128 * GF_UNIT_KB; + ctx->iobuf_pool = iobuf_pool_new (8 * GF_UNIT_MB, ctx->page_size + 4096); ctx->event_pool = event_pool_new (DEFAULT_EVENT_POOL_SIZE); pthread_mutex_init (&(ctx->lock), NULL); pool = ctx->pool = CALLOC (1, sizeof (call_pool_t)); @@ -1114,10 +1130,13 @@ main (int argc, char *argv[]) /* Create symlink to actual log file */ unlink (cmd_args->log_file); - symlink (tmp_logfile, cmd_args->log_file); - - FREE (cmd_args->log_file); - cmd_args->log_file = strdup (tmp_logfile); + ret = symlink (tmp_logfile, cmd_args->log_file); + if (-1 == ret) { + fprintf (stderr, "symlink of logfile failed"); + } else { + FREE (cmd_args->log_file); + cmd_args->log_file = strdup (tmp_logfile); + } } } |