Skip to content

Commit

Permalink
include: explicitly define environ for BSDs
Browse files Browse the repository at this point in the history
In file included from interop/PassItem.cpp:11:
include/subprocess.h:821:90: error: use of undeclared identifier 'environ'
        if (int err{::posix_spawnp(&pid, sh.argv()[0], action.get(), nullptr, sh.argv(), environ)}; err != 0)
                                                                                         ^

See also https://git.musl-libc.org/cgit/musl/commit/?id=d200bd727bea
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02 says:
> All identifiers in this volume of POSIX.1-2017, except `environ`,
> are defined in at least one of the headers, as shown in XBD Headers.
  • Loading branch information
jbeich committed Dec 21, 2021
1 parent 1381a09 commit 01cc706
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/subprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ extern "C"
#include <sys/wait.h>
#include <unistd.h>
#include <wordexp.h>

/* Have to be manually defined according to POSIX */
extern char **environ;
}

namespace subprocess
Expand Down

0 comments on commit 01cc706

Please sign in to comment.