[Libguestfs] [PATCH] Fix prototype of commandv to match prototype of commandrv.

Richard W.M. Jones rjones at redhat.com
Sun Nov 8 12:35:27 UTC 2009


Small const-correctness patch/tidy-up.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
-------------- next part --------------
>From 34ba249f8c9e3478cbff5a24ba958865106819a4 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Sun, 8 Nov 2009 11:55:38 +0000
Subject: [PATCH] Fix prototype of commandv to match prototype of commandrv.

---
 daemon/blockdev.c |    2 +-
 daemon/command.c  |    2 +-
 daemon/daemon.h   |    2 +-
 daemon/guestfsd.c |    5 +++--
 daemon/lvm.c      |    4 ++--
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/daemon/blockdev.c b/daemon/blockdev.c
index 1aa6eaa..4d3c2ab 100644
--- a/daemon/blockdev.c
+++ b/daemon/blockdev.c
@@ -53,7 +53,7 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints)
   } else
     argv[2] = device;
 
-  r = commandv (&out, &err, (char **) argv);
+  r = commandv (&out, &err, argv);
 
   if (r == -1) {
     reply_with_error ("%s: %s", argv[0], err);
diff --git a/daemon/command.c b/daemon/command.c
index b2b5ef9..b2350ec 100644
--- a/daemon/command.c
+++ b/daemon/command.c
@@ -85,7 +85,7 @@ do_command (char *const *argv)
   sys_ok = r != -1;
 
   CHROOT_IN;
-  r = commandv (&out, &err, argv);
+  r = commandv (&out, &err, (const char * const *) argv);
   CHROOT_OUT;
 
   if (sys_ok) command (NULL, NULL, "umount", sysroot_sys, NULL);
diff --git a/daemon/daemon.h b/daemon/daemon.h
index f082690..bfdde9d 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -59,7 +59,7 @@ extern int commandf (char **stdoutput, char **stderror, int flags,
 extern int commandrf (char **stdoutput, char **stderror, int flags,
 		      const char *name, ...);
 extern int commandvf (char **stdoutput, char **stderror, int flags,
-		      char *const *argv);
+                      char const *const *argv);
 extern int commandrvf (char **stdoutput, char **stderror, int flags,
 		       char const* const *argv);
 
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 370eea8..b6c3c44 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -548,7 +548,7 @@ commandf (char **stdoutput, char **stderror, int flags, const char *name, ...)
 
   va_end (args);
 
-  r = commandvf (stdoutput, stderror, flags, (char **) argv);
+  r = commandvf (stdoutput, stderror, flags, (const char * const*) argv);
 
   /* NB: Mustn't free the strings which are on the stack. */
   free (argv);
@@ -605,7 +605,8 @@ commandrf (char **stdoutput, char **stderror, int flags, const char *name, ...)
 
 /* Same as 'command', but passing an argv. */
 int
-commandvf (char **stdoutput, char **stderror, int flags, char *const *argv)
+commandvf (char **stdoutput, char **stderror, int flags,
+           char const *const *argv)
 {
   int r;
 
diff --git a/daemon/lvm.c b/daemon/lvm.c
index 9865bb2..3920e95 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -210,7 +210,7 @@ do_vgcreate (const char *volgroup, char *const *physvols)
   for (i = 3; i <= argc; ++i)
     argv[i] = physvols[i-3];
 
-  r = commandv (NULL, &err, (char **) argv);
+  r = commandv (NULL, &err, (const char * const*) argv);
   if (r == -1) {
     reply_with_error ("%s", err);
     free (err);
@@ -440,7 +440,7 @@ do_vg_activate (int activate, char *const *volgroups)
   for (i = 4; i <= argc; ++i)
     argv[i] = volgroups[i-4];
 
-  r = commandv (NULL, &err, (char **) argv);
+  r = commandv (NULL, &err, (const char * const*) argv);
   if (r == -1) {
     reply_with_error ("vgchange: %s", err);
     free (err);
-- 
1.6.5.rc2



More information about the Libguestfs mailing list