summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/process.c
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2012-04-29 00:22:01 +0200
committerBert Belder <bertbelder@gmail.com>2012-04-29 00:22:01 +0200
commitd2dd9d108d6bd61ac49522450b98ad57eac5be45 (patch)
treea53bd3b01637cff18fe01552f6a3cf006189929f /deps/uv/src/unix/process.c
parentc8a10e97c8def4c6a89f34f655b675d4204e16d4 (diff)
downloadandroid-node-v8-d2dd9d108d6bd61ac49522450b98ad57eac5be45.tar.gz
android-node-v8-d2dd9d108d6bd61ac49522450b98ad57eac5be45.tar.bz2
android-node-v8-d2dd9d108d6bd61ac49522450b98ad57eac5be45.zip
uv: upgrade to e2cae340a6
Diffstat (limited to 'deps/uv/src/unix/process.c')
-rw-r--r--deps/uv/src/unix/process.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c
index ffe014514b..10872cce61 100644
--- a/deps/uv/src/unix/process.c
+++ b/deps/uv/src/unix/process.c
@@ -105,7 +105,7 @@ int uv__make_socketpair(int fds[2], int flags) {
int uv__make_pipe(int fds[2], int flags) {
-#if HAVE_SYS_PIPE2
+#if __linux__
int fl;
fl = O_CLOEXEC;
@@ -113,17 +113,11 @@ int uv__make_pipe(int fds[2], int flags) {
if (flags & UV__F_NONBLOCK)
fl |= O_NONBLOCK;
- if (sys_pipe2(fds, fl) == 0)
+ if (uv__pipe2(fds, fl) == 0)
return 0;
if (errno != ENOSYS)
return -1;
-
- /* errno == ENOSYS so maybe the kernel headers lied about
- * the availability of pipe2(). This can happen if people
- * build libuv against newer kernel headers than the kernel
- * they actually run the software on.
- */
#endif
if (pipe(fds))
@@ -180,6 +174,12 @@ int uv_spawn(uv_loop_t* loop, uv_process_t* process,
pid_t pid;
int flags;
+ assert(options.file != NULL);
+ assert(!(options.flags & ~(UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS |
+ UV_PROCESS_SETGID |
+ UV_PROCESS_SETUID)));
+
+
uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS);
loop->counters.process_init++;
@@ -269,6 +269,16 @@ int uv_spawn(uv_loop_t* loop, uv_process_t* process,
_exit(127);
}
+ if ((options.flags & UV_PROCESS_SETGID) && setgid(options.gid)) {
+ perror("setgid()");
+ _exit(127);
+ }
+
+ if ((options.flags & UV_PROCESS_SETUID) && setuid(options.uid)) {
+ perror("setuid()");
+ _exit(127);
+ }
+
environ = options.env;
execvp(options.file, options.args);
@@ -368,3 +378,8 @@ uv_err_t uv_kill(int pid, int signum) {
return uv_ok_;
}
}
+
+
+void uv__process_close(uv_process_t* handle) {
+ ev_child_stop(handle->loop->ev, &handle->child_watcher);
+}