From 452611fff7a759c7b5cbeb75092bea7086817007 Mon Sep 17 00:00:00 2001
Message-Id: <452611fff7a759c7b5cbeb75092bea7086817007.1342518105.git.minovotn@redhat.com>
In-Reply-To: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com>
References: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com>
From: Luiz Capitulino <lcapitulino@redhat.com>
Date: Tue, 5 Jun 2012 14:58:50 +0200
Subject: [PATCH 40/41] qemu-ga: Fix use of environ on Darwin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

RH-Author: Luiz Capitulino <lcapitulino@redhat.com>
Message-id: <1338908331-15633-36-git-send-email-lcapitulino@redhat.com>
Patchwork-id: 39932
O-Subject: [PATCH RHEL6.4 qemu-kvm 35/36] qemu-ga: Fix use of environ on Darwin
Bugzilla: 827612
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

From: Andreas Färber <andreas.faerber@web.de>

Use _NSGetEnviron() helper to access the environment.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Charlie Somerville <charlie@charliesomerville.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit eecae14724b64d43f9a44b9b4e69143961c201a3)

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qga/commands-posix.c | 5 +++++
 1 file changed, 5 insertions(+)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 qga/commands-posix.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 2e0a888..1077ae8 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -36,8 +36,13 @@
 #include "host-utils.h"
 
 #ifndef CONFIG_HAS_ENVIRON
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
 extern char **environ;
 #endif
+#endif
 
 /* file-* commands are compile-time disabled for RHEL/RHEV.
  * To enable, set to '1' */
-- 
1.7.10.4

