]> git.itanic.dy.fi Git - rrdd/commitdiff
rrdtool: Set up the correct executable name when running processes
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sun, 22 Apr 2012 18:46:42 +0000 (21:46 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sun, 22 Apr 2012 18:46:42 +0000 (21:46 +0300)
The first argument, the name of the executable, should be set properly
prior running execv(). This ensures the process knows properly how it
was called. There might be a difference in case the process implements
multiple personalities based on the name it was called.

This does not appear to be the case with rrdtool as it was working
even if the executable name was left blank.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
rrdtool.c

index b491b6e3b098ed71e155e3a49c4160d3ae2edd4a..a7ad86ebe50dc0ac6023db38adf6141b3680927d 100644 (file)
--- a/rrdtool.c
+++ b/rrdtool.c
@@ -64,7 +64,7 @@ int rrdtool_draw_image(struct rrd_image *image)
        timestamp[j] = 0;
 
 
-       add_arg(args, argcnt, argstr, idx, " ");
+       add_arg(args, argcnt, argstr, idx, RRDTOOL_CMD);
        add_arg(args, argcnt, argstr, idx, "graph");
        add_arg(args, argcnt, argstr, idx, "%s", tmpfile);
 
@@ -167,7 +167,7 @@ int rrdtool_update_data(struct rrd_database *rrd)
        char cmd[] = RRDTOOL_CMD;
 //     char cmd[] = "echo";
        char *cmdline[] = {
-               "",
+               RRDTOOL_CMD,
                "update",
                rrd->filename,
                data,
@@ -220,7 +220,7 @@ static int create_database(struct rrd_database *db)
                return -1;
        }
 
-       add_arg(args, argcnt, argstr, idx, " ");
+       add_arg(args, argcnt, argstr, idx, RRDTOOL_CMD);
        add_arg(args, argcnt, argstr, idx, "create");
        add_arg(args, argcnt, argstr, idx, "%s", db->filename);
        add_arg(args, argcnt, argstr, idx, "--step");