qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration
Date: Thu, 24 May 2012 13:52:41 -0500	[thread overview]
Message-ID: <1337885561-10629-3-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1337885561-10629-1-git-send-email-mdroth@linux.vnet.ibm.com>

From: Luiz Capitulino <lcapitulino@redhat.com>

Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global
variable, but is relying on environ to be declared somewhere else.

This worked for me because on F16 environ is declared in <unistd.h>, but
that doesn't happen in OpenBSD for example, causing a build failure.

This commit fixes the build error by declaring environ if it hasn't
being declared yet.

Also fixes a build warning due to a missing <sys/wait.h> include.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-posix.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 7664be1..dab3bf9 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -14,12 +14,17 @@
 #include <glib.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
+#include <sys/wait.h>
 #include "qga/guest-agent-core.h"
 #include "qga-qmp-commands.h"
 #include "qerror.h"
 #include "qemu-queue.h"
 #include "host-utils.h"
 
+#ifndef CONFIG_HAS_ENVIRON
+extern char **environ;
+#endif
+
 #if defined(__linux__)
 #include <mntent.h>
 #include <linux/fs.h>
@@ -27,7 +32,6 @@
 #include <arpa/inet.h>
 #include <sys/socket.h>
 #include <net/if.h>
-#include <sys/wait.h>
 
 #if defined(__linux__) && defined(FIFREEZE)
 #define CONFIG_FSFREEZE
-- 
1.7.4.1

  parent reply	other threads:[~2012-05-24 18:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24 18:52 [Qemu-devel] [PULL 1.1] qemu-ga build fix for OpenBSD Michael Roth
2012-05-24 18:52 ` [Qemu-devel] [PATCH 1/2] configure: check if environ is declared Michael Roth
2012-05-24 18:52 ` Michael Roth [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-23 18:48 [Qemu-devel] [PATCH 1.1 0/2]: qemu-ga: fix build on openbsd Luiz Capitulino
2012-05-23 18:48 ` [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337885561-10629-3-git-send-email-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).