Subject: bug#9772: bug#10155: OSX breakage

From: Chong Yidong <[email-masked]>
Date: Wed, 30 Nov 2011 10:45:42 +0800

Paul Eggert <[email-masked]> writes:

> On 11/29/11 09:30, Eli Zaretskii wrote:
>> I wonder if we could have a much smaller change that
>> fixes just that single problem.
>
> Yes we could, though it would involve more of the patch
> than the part that you've identified, and it would involve
> some other stuff done by hand.  The simplest way to think
> about it is, I expect, is that it would be a fork of gnulib.
> I could look into preparing such a patch but it would take
> some time and would introduce other reliability concerns,
> so I hope I don't have to do that....

OK, then let's go with the ifdef conditioning directly in the Emacs
sources.

But is conditioning on OS X and FreeBSD the right thing?  We don't know
if it fails on other BSDs.  Since revno 106533 was intended to fix the
MS-WINDOWS build, I think it's better to condition it for WINDOWSNT for
now, as below:

Eli, WDYT?

=== modified file 'lib-src/emacsclient.c'
*** lib-src/emacsclient.c	2011-11-27 18:52:53 +0000
--- lib-src/emacsclient.c	2011-11-30 02:44:47 +0000
***************
*** 1635,1640 ****
--- 1635,1645 ----
    /* Send over our environment and current directory. */
    if (!current_frame)
      {
+ #ifndef WINDOWSNT
+       /* This is defined in stdlib.h on MS-Windows.  It's defined in
+ 	 unistd.h on some POSIX hosts, but not all (Bug#10155).  */
+       extern char **environ;
+ #endif
        int i;
        for (i = 0; environ[i]; i++)
          {