libxl: fix compiler warning with fork_exec_bootloader
authorAndre Przywara <andre.przywara@amd.com>
Thu, 16 Sep 2010 16:39:33 +0000 (17:39 +0100)
committerAndre Przywara <andre.przywara@amd.com>
Thu, 16 Sep 2010 16:39:33 +0000 (17:39 +0100)
At least one of my compilers complains about the broken const
qualifier in the fork_exec_bootloader() call (despite the cast).
Fix this properly by propagating the const attribute down the
call stack.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_bootloader.c
tools/libxl/libxl_exec.c
tools/libxl/libxl_internal.h

index 0f884e4668737ef56cd032ce8853b766ce5862d1..6c0408a0fdc1c130ab37488168dded5d12279644 100644 (file)
@@ -118,7 +118,7 @@ static int open_xenconsoled_pty(int *master, int *slave, char *slave_path, size_
     return 0;
 }
 
-static pid_t fork_exec_bootloader(int *master, char *arg0, char **args)
+static pid_t fork_exec_bootloader(int *master, const char *arg0, char **args)
 {
     struct termios termattr;
     pid_t pid = forkpty(master, NULL, NULL, NULL);
@@ -386,7 +386,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
     dom_console_xs_path = libxl__sprintf(&gc, "%s/console/tty", libxl__xs_get_dompath(&gc, domid));
     libxl__xs_write(&gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
 
-    pid = fork_exec_bootloader(&bootloader_fd, (char *)info->u.pv.bootloader, args);
+    pid = fork_exec_bootloader(&bootloader_fd, info->u.pv.bootloader, args);
     if (pid < 0) {
         goto out_close;
     }
index 56d738e0f18e3fdec70e183a8c90babecc548cc5..31980fb1baa910ba21f03763a5ea5d2e6411c607 100644 (file)
@@ -35,7 +35,8 @@ static int call_waitpid(pid_t (*waitpid_cb)(pid_t, int *, int), pid_t pid, int *
     return (waitpid_cb) ? waitpid_cb(pid, status, options) : waitpid(pid, status, options);
 }
 
-void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args)
+void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, const char *arg0,
+                char **args)
      /* call this in the child */
 {
     int i;
index 7ddb9809590d3188dce5a64faf4bdacb89d73f14..ba6041f14b7e4861c6b93dccd27e4ab183283a78 100644 (file)
@@ -221,7 +221,8 @@ _hidden int libxl__spawn_check(libxl_ctx *ctx,
 
  /* low-level stuff, for synchronous subprocesses etc. */
 
-_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args); // logs errors, never returns
+_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd,
+               const char *arg0, char **args); // logs errors, never returns
 _hidden void libxl__log_child_exitstatus(libxl__gc *gc,
                                 const char *what, pid_t pid, int status);