Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/boost/process/v1/detail/posix/environment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class native_environment_impl<char>
using string_type = std::basic_string<char_type>;
using native_handle_type = char_type **;

void reload() {this->_env_impl = ::environ;}
void reload() {this->_env_impl = environ;}

string_type get(const pointer_type id) { return getenv(id); }
void set(const pointer_type id, const pointer_type value)
Expand Down Expand Up @@ -136,7 +136,7 @@ class native_environment_impl<char>
native_environment_impl & operator=(native_environment_impl && ) = default;
native_handle_type _env_impl = environ;

native_handle_type native_handle() const {return ::environ;}
native_handle_type native_handle() const {return environ;}
};


Expand Down
4 changes: 2 additions & 2 deletions include/boost/process/v1/detail/posix/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class executor
prepare_cmd_style_fn = exe;
if ((prepare_cmd_style_fn.find('/') == std::string::npos) && ::access(prepare_cmd_style_fn.c_str(), X_OK))
{
const auto * e = ::environ;
const auto * e = environ;
while ((e != nullptr) && (*e != nullptr) && !boost::starts_with(*e, "PATH="))
e++;

Expand Down Expand Up @@ -316,7 +316,7 @@ class executor
const char * exe = nullptr;
char *const* cmd_line = nullptr;
bool cmd_style = false;
char **env = ::environ;
char **env = environ;
pid_t pid = -1;
std::shared_ptr<std::atomic<int>> exit_status = std::make_shared<std::atomic<int>>(still_active);

Expand Down
2 changes: 1 addition & 1 deletion include/boost/process/v1/extend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ struct posix_executor
///A pointer to the argument-vector.
char *const* cmd_line = nullptr;
///A pointer to the environment variables, as default it is set to [environ](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html)
char **env = ::environ;
char **env = environ;
///The pid of the process - it will be -1 before invoking [fork](http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html), and after forking either 0 for the new process or a positive value if in the current process. */
pid_t pid = -1;
///This shared-pointer holds the exit code. It's done this way, so it can be shared between an `asio::io_context` and \ref child.
Expand Down
9 changes: 7 additions & 2 deletions include/boost/process/v2/detail/environment_posix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@
#include <boost/process/v2/detail/config.hpp>
#include <boost/process/v2/cstring_ref.hpp>

#if defined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun)
extern "C" { extern char **environ; }
#if defined(__APPLE__)
# include <crt_externs.h>
# if !defined(environ)
# define environ (*_NSGetEnviron())
# endif
#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun)
extern "C" { extern char **environ; }
#endif

BOOST_PROCESS_V2_BEGIN_NAMESPACE
Expand Down
12 changes: 8 additions & 4 deletions include/boost/process/v2/posix/default_launcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
#include <sys/wait.h>
#include <unistd.h>


#if defined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun)
extern "C" { extern char **environ; }
#if defined(__APPLE__)
# include <crt_externs.h>
# if !defined(environ)
# define environ (*_NSGetEnviron())
# endif
#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun)
extern "C" { extern char **environ; }
#endif

BOOST_PROCESS_V2_BEGIN_NAMESPACE
Expand Down Expand Up @@ -260,7 +264,7 @@ inline void on_exec_error(Launcher & launcher, const filesystem::path &executabl
struct default_launcher
{
/// The pointer to the environment forwarded to the subprocess.
const char * const * env = ::environ;
const char * const * env = environ;
/// The pid of the subprocess - will be assigned after fork.
int pid = -1;

Expand Down
2 changes: 1 addition & 1 deletion src/detail/environment_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void unset(basic_cstring_ref<char_type, key_char_traits<char_type>> key, error_c
}


native_handle_type load_native_handle() { return ::environ; }
native_handle_type load_native_handle() { return environ; }


native_iterator next(native_iterator nh)
Expand Down
2 changes: 1 addition & 1 deletion src/posix/close_handles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void close_all(const std::vector<int> & whitelist, error_code & ec)
return ;
}

auto dir_fd = ::dirfd(dir.get());
auto dir_fd = dirfd(dir.get());
if (dir_fd == -1)
{
ec = BOOST_PROCESS_V2_NAMESPACE::detail::get_last_error();
Expand Down
2 changes: 1 addition & 1 deletion test/v1/limit_fd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE(leak_test, *boost::unit_test::timeout(5))
BOOST_CHECK(!bt::is_stream_handle(event_fd , ec)); BOOST_CHECK_MESSAGE(!ec, ec.message());
#endif
auto od = ::opendir(".");
int dir_fd = ::dirfd(od);
int dir_fd = dirfd(od);
BOOST_CHECK(!bt::is_stream_handle(dir_fd , ec)); BOOST_CHECK_MESSAGE(!ec, ec.message());
#endif

Expand Down
Loading