typo setuid -> setsid
This commit is contained in:
parent
907e569980
commit
63bd237892
@ -185,7 +185,7 @@ ChildProcess.prototype.kill = function(sig) {
|
|||||||
ChildProcess.prototype.spawn = function(path, args, options, customFds) {
|
ChildProcess.prototype.spawn = function(path, args, options, customFds) {
|
||||||
args = args || [];
|
args = args || [];
|
||||||
|
|
||||||
var cwd, env, setuid;
|
var cwd, env, setsid;
|
||||||
if (!options || options.cwd === undefined &&
|
if (!options || options.cwd === undefined &&
|
||||||
options.env === undefined &&
|
options.env === undefined &&
|
||||||
options.customFds === undefined) {
|
options.customFds === undefined) {
|
||||||
@ -193,13 +193,13 @@ ChildProcess.prototype.spawn = function(path, args, options, customFds) {
|
|||||||
cwd = '';
|
cwd = '';
|
||||||
env = options || process.env;
|
env = options || process.env;
|
||||||
customFds = customFds || [-1, -1, -1];
|
customFds = customFds || [-1, -1, -1];
|
||||||
setuid = false;
|
setsid = false;
|
||||||
} else {
|
} else {
|
||||||
// Recommended API: (path, args, options)
|
// Recommended API: (path, args, options)
|
||||||
cwd = options.cwd || '';
|
cwd = options.cwd || '';
|
||||||
env = options.env || process.env;
|
env = options.env || process.env;
|
||||||
customFds = options.customFds || [-1, -1, -1];
|
customFds = options.customFds || [-1, -1, -1];
|
||||||
setuid = options.setuid ? true : false;
|
setsid = options.setsid ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var envPairs = [];
|
var envPairs = [];
|
||||||
@ -214,7 +214,7 @@ ChildProcess.prototype.spawn = function(path, args, options, customFds) {
|
|||||||
cwd,
|
cwd,
|
||||||
envPairs,
|
envPairs,
|
||||||
customFds,
|
customFds,
|
||||||
setuid);
|
setsid);
|
||||||
this.fds = fds;
|
this.fds = fds;
|
||||||
|
|
||||||
if (customFds[0] === -1 || customFds[0] === undefined) {
|
if (customFds[0] === -1 || customFds[0] === undefined) {
|
||||||
|
@ -150,15 +150,15 @@ Handle<Value> ChildProcess::Spawn(const Arguments& args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_setuid = false;
|
int do_setsid = false;
|
||||||
if (args[5]->IsBoolean()) {
|
if (args[5]->IsBoolean()) {
|
||||||
do_setuid = args[5]->BooleanValue();
|
do_setsid = args[5]->BooleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int fds[3];
|
int fds[3];
|
||||||
|
|
||||||
int r = child->Spawn(argv[0], argv, cwd, env, fds, custom_fds, do_setuid);
|
int r = child->Spawn(argv[0], argv, cwd, env, fds, custom_fds, do_setsid);
|
||||||
|
|
||||||
for (i = 0; i < argv_length; i++) free(argv[i]);
|
for (i = 0; i < argv_length; i++) free(argv[i]);
|
||||||
delete [] argv;
|
delete [] argv;
|
||||||
@ -233,7 +233,7 @@ int ChildProcess::Spawn(const char *file,
|
|||||||
char **env,
|
char **env,
|
||||||
int stdio_fds[3],
|
int stdio_fds[3],
|
||||||
int custom_fds[3],
|
int custom_fds[3],
|
||||||
bool do_setuid) {
|
bool do_setsid) {
|
||||||
HandleScope scope;
|
HandleScope scope;
|
||||||
assert(pid_ == -1);
|
assert(pid_ == -1);
|
||||||
assert(!ev_is_active(&child_watcher_));
|
assert(!ev_is_active(&child_watcher_));
|
||||||
@ -274,8 +274,8 @@ int ChildProcess::Spawn(const char *file,
|
|||||||
return -4;
|
return -4;
|
||||||
|
|
||||||
case 0: // Child.
|
case 0: // Child.
|
||||||
if (do_setuid && setsid() < 0) {
|
if (do_setsid && setsid() < 0) {
|
||||||
perror("setuid");
|
perror("setsid");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (custom_fds[0] == -1) {
|
if (custom_fds[0] == -1) {
|
||||||
|
@ -64,7 +64,7 @@ class ChildProcess : ObjectWrap {
|
|||||||
char **env,
|
char **env,
|
||||||
int stdio_fds[3],
|
int stdio_fds[3],
|
||||||
int custom_fds[3],
|
int custom_fds[3],
|
||||||
bool do_setuid);
|
bool do_setsid);
|
||||||
|
|
||||||
// Simple syscall wrapper. Does not disable the watcher. onexit will be
|
// Simple syscall wrapper. Does not disable the watcher. onexit will be
|
||||||
// called still.
|
// called still.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user