|| (strncmp ("unix:", sd_path, strlen ("unix:")) == 0))
is_unix = 1;
- if (*path == '/') /* absolute path */
+ if (is_unix)
{
- if (! is_unix)
- {
- rrd_set_error ("absolute path names not allowed when talking "
- "to a remote daemon");
- return (NULL);
- }
- /* else: nothing to do */
+ ret = realpath(path, resolved_path);
+ if (ret == NULL)
+ rrd_set_error("realpath(%s): %s", path, rrd_strerror(errno));
+ return ret;
}
- else /* relative path */
+ else
{
- if (is_unix)
+ if (*path == '/') /* not absolute path */
{
- realpath (path, resolved_path);
- ret = resolved_path;
+ rrd_set_error ("absolute path names not allowed when talking "
+ "to a remote daemon");
+ return NULL;
}
- /* else: nothing to do */
}
- return (ret);
+
+ return path;
} /* }}} char *get_path */
static size_t strsplit (char *string, char **fields, size_t size) /* {{{ */