diff mbox

[for-1.1] qemu-ga: Fix use of environ on Darwin

Message ID 1338130940-43034-1-git-send-email-andreas.faerber@web.de
State New
Headers show

Commit Message

Andreas Färber May 27, 2012, 3:02 p.m. UTC
Use _NSGetEnviron() helper to access the environment.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Charlie Somerville <charlie@charliesomerville.com>
---
 Michael, can you please append this to your qemu-ga PULL?
 
 qga/commands-posix.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Andreas Färber May 27, 2012, 3:07 p.m. UTC | #1
Am 27.05.2012 17:02, schrieb Andreas Färber:
> Use _NSGetEnviron() helper to access the environment.
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> Cc: Charlie Somerville <charlie@charliesomerville.com>
> ---
>  Michael, can you please append this to your qemu-ga PULL?
>  
>  qga/commands-posix.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index dab3bf9..4a71c27 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -22,8 +22,13 @@
>  #include "host-utils.h"
>  
>  #ifndef CONFIG_HAS_ENVIRON
> +#ifdef __APPLE__
> +#include <crt_externs.h>
> +#define environ (*_NSGetEnviron())
> +#else
>  extern char **environ;
>  #endif
> +#endif
>  
>  #if defined(__linux__)
>  #include <mntent.h>

For 1.2 it might also be a good idea to move this block to osdep.h, so
that it doesn't get duplicated when needed somewhere else.

Andreas
Michael Roth May 29, 2012, 3:27 p.m. UTC | #2
On Sun, May 27, 2012 at 05:02:20PM +0200, Andreas Färber wrote:
> Use _NSGetEnviron() helper to access the environment.
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> Cc: Charlie Somerville <charlie@charliesomerville.com>
> ---
>  Michael, can you please append this to your qemu-ga PULL?

Thanks, applied to qga tree. I'll send an updated PULL and mark the other one
stale.

> 
>  qga/commands-posix.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index dab3bf9..4a71c27 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -22,8 +22,13 @@
>  #include "host-utils.h"
> 
>  #ifndef CONFIG_HAS_ENVIRON
> +#ifdef __APPLE__
> +#include <crt_externs.h>
> +#define environ (*_NSGetEnviron())
> +#else
>  extern char **environ;
>  #endif
> +#endif
> 
>  #if defined(__linux__)
>  #include <mntent.h>
> -- 
> 1.7.5.3
>
diff mbox

Patch

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index dab3bf9..4a71c27 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -22,8 +22,13 @@ 
 #include "host-utils.h"
 
 #ifndef CONFIG_HAS_ENVIRON
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
 extern char **environ;
 #endif
+#endif
 
 #if defined(__linux__)
 #include <mntent.h>