X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Frrd_daemon.c;h=a3e03684770283043bec5a1520746f1cba6e09d4;hb=60f717e66b36084e19d2be67c66a621ea2499855;hp=25675a1c9725ac3f61c1227d43a343e7c878da46;hpb=0cf61ecda624ab695eeb8f73c189d6f72479d351;p=rrdtool.git diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 25675a1..a3e0368 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -114,8 +114,9 @@ #define RRDD_LOG(severity, ...) \ do { \ - if (stay_foreground) \ + if (stay_foreground) { \ fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); } \ syslog ((severity), __VA_ARGS__); \ } while (0) @@ -1476,7 +1477,7 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */ static int handle_request_fetch (HANDLER_PROTO) /* {{{ */ { - char *file; + char *file, file_tmp[PATH_MAX]; char *cf; char *start_str; @@ -1530,6 +1531,9 @@ static int handle_request_fetch (HANDLER_PROTO) /* {{{ */ if (status != 0) return (syntax_error(sock,cmd)); + get_abs_path(&file, file_tmp); + if (!check_file_access(file, sock)) return 0; + status = flush_file (file); if ((status != 0) && (status != ENOENT)) return (send_response (sock, RESP_ERR, @@ -1572,7 +1576,7 @@ static int handle_request_fetch (HANDLER_PROTO) /* {{{ */ value = strtol (end_str, &endptr, /* base = */ 0); if ((endptr == end_str) || (errno != 0)) return (send_response(sock, RESP_ERR, - "Cannot parse start time `%s': Only simple integers are allowed.\n", + "Cannot parse end time `%s': Only simple integers are allowed.\n", end_str)); if (value > 0) @@ -1628,7 +1632,9 @@ static int handle_request_fetch (HANDLER_PROTO) /* {{{ */ if (i > 0) SSTRCAT (linebuf, " ", linebuf_fill); SSTRCAT (linebuf, ds_namv[i], linebuf_fill); + rrd_freemem(ds_namv[i]); } + rrd_freemem(ds_namv); add_response_info (sock, "DSName: %s\n", linebuf); } @@ -1654,6 +1660,7 @@ static int handle_request_fetch (HANDLER_PROTO) /* {{{ */ add_response_info (sock, "%10lu:%s\n", (unsigned long) t, linebuf); } /* for (t) */ + rrd_freemem(data); return (send_response (sock, RESP_OK, "Success\n")); #undef SSTRCAT