summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: faf5ffa)
raw | patch | inline | side by side (parent: faf5ffa)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 4 Oct 2009 11:29:40 +0000 (11:29 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 4 Oct 2009 11:29:40 +0000 (11:29 +0000) |
The daemon checks if the specified base directory contains symlinks by
comparing the canonicalized path name (by realpath()) with the path name
specified on the command line. The GNU libc's implementation of realpath()
removed trailing slashes ('/') from the pathname. Thus, specifying a base
directory with a trailing slash results in rrdcached aborting, complaining
about an invalid base directory, which is quite annoying imho. Now, trailing
slashes are removed before comparing the two path names. -- Sebastian Harl
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1923 a5681a0c-68f1-0310-ab6d-d61299d08faa
comparing the canonicalized path name (by realpath()) with the path name
specified on the command line. The GNU libc's implementation of realpath()
removed trailing slashes ('/') from the pathname. Thus, specifying a base
directory with a trailing slash results in rrdcached aborting, complaining
about an invalid base directory, which is quite annoying imho. Now, trailing
slashes are removed before comparing the two path names. -- Sebastian Harl
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1923 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_daemon.c | patch | blob | history |
diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index fa7dc41bac4cf62837d2517f3a66f707ad5ff44b..7406325ce6e4ec6b95f1c7dbd2ef435bd32b4f85 100644 (file)
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
"%s\n", config_base_dir, rrd_strerror(errno));
return 5;
}
- else if (strncmp(config_base_dir,
- base_realpath, sizeof(base_realpath)) != 0)
- {
- fprintf(stderr,
- "Base directory (-b) resolved via file system links!\n"
- "Please consult rrdcached '-b' documentation!\n"
- "Consider specifying the real directory (%s)\n",
- base_realpath);
- return 5;
- }
len = strlen (config_base_dir);
while ((len > 0) && (config_base_dir[len - 1] == '/'))
}
_config_base_dir_len = len;
+
+ len = strlen (base_realpath);
+ while ((len > 0) && (base_realpath[len - 1] == '/'))
+ {
+ base_realpath[len - 1] = '\0';
+ len--;
+ }
+
+ if (strncmp(config_base_dir,
+ base_realpath, sizeof(base_realpath)) != 0)
+ {
+ fprintf(stderr,
+ "Base directory (-b) resolved via file system links!\n"
+ "Please consult rrdcached '-b' documentation!\n"
+ "Consider specifying the real directory (%s)\n",
+ base_realpath);
+ return 5;
+ }
}
break;