From e6f074f93195b2e7d92812f26782e8dc281a1329 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 30 Dec 2009 21:45:20 +0000 Subject: default log file now doesn't start with '-' Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 490 (Default log file path should not begin with '-') URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=490 --- glusterfsd/src/glusterfsd.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index fb9e6c42418..d3f1be02867 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1013,16 +1013,21 @@ int set_log_file_path (cmd_args_t *cmd_args) { int i = 0; + int j = 0; int ret = 0; int port = 0; char *tmp_ptr = NULL; char tmp_str[1024] = {0,}; if (cmd_args->mount_point) { - for (i = 1; i < strlen (cmd_args->mount_point); i++) { - tmp_str[i-1] = cmd_args->mount_point[i]; + j = 0; + i = 0; + if (cmd_args->mount_point[0] == '/') + i = 1; + for (; i < strlen (cmd_args->mount_point); i++,j++) { + tmp_str[j] = cmd_args->mount_point[i]; if (cmd_args->mount_point[i] == '/') - tmp_str[i-1] = '-'; + tmp_str[j] = '-'; } ret = asprintf (&cmd_args->log_file, DEFAULT_LOG_FILE_DIRECTORY "/%s.log", @@ -1035,10 +1040,14 @@ set_log_file_path (cmd_args_t *cmd_args) } if (cmd_args->volume_file) { - for (i = 0; i < strlen (cmd_args->volume_file); i++) { - tmp_str[i] = cmd_args->volume_file[i]; + j = 0; + i = 0; + if (cmd_args->volume_file[0] == '/') + i = 1; + for (; i < strlen (cmd_args->volume_file); i++,j++) { + tmp_str[j] = cmd_args->volume_file[i]; if (cmd_args->volume_file[i] == '/') - tmp_str[i] = '-'; + tmp_str[j] = '-'; } ret = asprintf (&cmd_args->log_file, DEFAULT_LOG_FILE_DIRECTORY "/%s.log", -- cgit