summaryrefslogtreecommitdiffstats
path: root/glusterfsd/src
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-12-30 21:45:20 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-01-14 23:23:53 -0800
commite6f074f93195b2e7d92812f26782e8dc281a1329 (patch)
treefecdb89aefdc58af7224453d733fb96f019ca1ff /glusterfsd/src
parent5522f6eaef99616efe01b8f4688be0486e511b12 (diff)
default log file now doesn't start with '-'
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 490 (Default log file path should not begin with '-') URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=490
Diffstat (limited to 'glusterfsd/src')
-rw-r--r--glusterfsd/src/glusterfsd.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index fb9e6c424..d3f1be028 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",