[PATCH] handle_request_fetch needs to convert to absolute path

Thorsten von Eicken <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Organization RightScale, Inc.
Message-ID <[email protected]>
I couldn't make the rrdcached FETCH command work with relative paths 
(over a socket) without the following patch. Dunno how it worked for 
anyone else...
Regards,
     Thorsten

--- rrd_daemon.c.orig   2010-04-30 16:13:40.000000000 +0000
+++ rrd_daemon.c        2010-05-06 06:37:32.000000000 +0000
@@ -1476,7 +1476,7 @@

  static int handle_request_fetch (HANDLER_PROTO) /* {{{ */
  {
-  char *file;
+  char *file, file_tmp[PATH_MAX];
    char *cf;

    char *start_str;
@@ -1530,10 +1530,14 @@
    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))
+  if ((status != 0) && (status != ENOENT)) {
      return (send_response (sock, RESP_ERR,
            "flush_file (%s) failed with status %i.\n", file, status));
+  }

    t = time (NULL); /* "now" */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.