[libvirt] [PATCH] Cast args/env for execve in virCommand

'char **' is not compatible with 'const char* const*' so needs an explicit cast. Fixes the build on MinGW * src/util/command.c: Cast args/env for execve --- src/util/command.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/util/command.c b/src/util/command.c index 78586e8..d63b984 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -1000,7 +1000,9 @@ int virCommandExec(virCommandPtr cmd) return -1; } - return execve(cmd->args[0], cmd->args, cmd->env); + return execve(cmd->args[0], + (const char *const *)cmd->args, + (const char *const *)cmd->env); } /* -- 1.7.4.4

On 05/12/2011 10:29 AM, Daniel P. Berrange wrote:
'char **' is not compatible with 'const char* const*' so needs an explicit cast. Fixes the build on MinGW
* src/util/command.c: Cast args/env for execve --- src/util/command.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c index 78586e8..d63b984 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -1000,7 +1000,9 @@ int virCommandExec(virCommandPtr cmd) return -1; }
- return execve(cmd->args[0], cmd->args, cmd->env); + return execve(cmd->args[0], + (const char *const *)cmd->args, + (const char *const *)cmd->env);
ACK - this fixes things for now. But we really should be fixing the broken signature of mingw execve via a gnulib module (not yet written). -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Thu, May 12, 2011 at 10:37:04AM -0600, Eric Blake wrote:
On 05/12/2011 10:29 AM, Daniel P. Berrange wrote:
'char **' is not compatible with 'const char* const*' so needs an explicit cast. Fixes the build on MinGW
* src/util/command.c: Cast args/env for execve --- src/util/command.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c index 78586e8..d63b984 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -1000,7 +1000,9 @@ int virCommandExec(virCommandPtr cmd) return -1; }
- return execve(cmd->args[0], cmd->args, cmd->env); + return execve(cmd->args[0], + (const char *const *)cmd->args, + (const char *const *)cmd->env);
ACK - this fixes things for now. But we really should be fixing the broken signature of mingw execve via a gnulib module (not yet written).
Actually it doesn't work, because it breaks the native build instead. I've sent a different patch which just disables this, since it is unused on Win32 Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 05/12/2011 12:29 PM, Daniel P. Berrange wrote:
'char **' is not compatible with 'const char* const*' so needs an explicit cast. Fixes the build on MinGW
* src/util/command.c: Cast args/env for execve --- src/util/command.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c index 78586e8..d63b984 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -1000,7 +1000,9 @@ int virCommandExec(virCommandPtr cmd) return -1; }
- return execve(cmd->args[0], cmd->args, cmd->env); + return execve(cmd->args[0], + (const char *const *)cmd->args, + (const char *const *)cmd->env); }
/*
ACK - Cole
participants (3)
-
Cole Robinson
-
Daniel P. Berrange
-
Eric Blake