projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rrd_open: include rrd_tool.h at the very start so that utime.h gets included if...
[rrdtool.git]
/
src
/
rrd_client.c
diff --git
a/src/rrd_client.c
b/src/rrd_client.c
index
b677d4f
..
d292281
100644
(file)
--- a/
src/rrd_client.c
+++ b/
src/rrd_client.c
@@
-77,26
+77,24
@@
static const char *get_path (const char *path, char *resolved_path) /* {{{ */
|| (strncmp ("unix:", sd_path, strlen ("unix:")) == 0))
is_unix = 1;
|| (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) /* {{{ */
} /* }}} char *get_path */
static size_t strsplit (char *string, char **fields, size_t size) /* {{{ */
@@
-376,14
+374,17
@@
static int response_read (rrdc_response_t **ret_response) /* {{{ */
ret->lines_num = 0;
buffer_ptr = fgets (buffer, sizeof (buffer), sh);
ret->lines_num = 0;
buffer_ptr = fgets (buffer, sizeof (buffer), sh);
- if (buffer_ptr == NULL)
+ if (buffer_ptr == NULL) {
+ close_connection();
return (-3);
return (-3);
+ }
chomp (buffer);
ret->status = strtol (buffer, &ret->message, 0);
if (buffer == ret->message)
{
response_free (ret);
chomp (buffer);
ret->status = strtol (buffer, &ret->message, 0);
if (buffer == ret->message)
{
response_free (ret);
+ close_connection();
return (-4);
}
/* Skip leading whitespace of the status message */
return (-4);
}
/* Skip leading whitespace of the status message */
@@
-401,6
+402,7
@@
static int response_read (rrdc_response_t **ret_response) /* {{{ */
if (ret->lines == NULL)
{
response_free (ret);
if (ret->lines == NULL)
{
response_free (ret);
+ close_connection();
return (-5);
}
memset (ret->lines, 0, sizeof (char *) * ret->status);
return (-5);
}
memset (ret->lines, 0, sizeof (char *) * ret->status);
@@
-412,6
+414,7
@@
static int response_read (rrdc_response_t **ret_response) /* {{{ */
if (buffer_ptr == NULL)
{
response_free (ret);
if (buffer_ptr == NULL)
{
response_free (ret);
+ close_connection();
return (-6);
}
chomp (buffer);
return (-6);
}
chomp (buffer);
@@
-420,6
+423,7
@@
static int response_read (rrdc_response_t **ret_response) /* {{{ */
if (ret->lines[i] == NULL)
{
response_free (ret);
if (ret->lines[i] == NULL)
{
response_free (ret);
+ close_connection();
return (-7);
}
}
return (-7);
}
}
@@
-824,7
+828,7
@@
int rrdc_fetch (const char *filename, /* {{{ */
size_t buffer_size;
rrdc_response_t *res;
char path_buffer[PATH_MAX];
size_t buffer_size;
rrdc_response_t *res;
char path_buffer[PATH_MAX];
- char *path_ptr;
+ c
onst c
har *path_ptr;
char *str_tmp;
unsigned long flush_version;
char *str_tmp;
unsigned long flush_version;