char skip_argument[1];
-pid_t pipespawnv_passwd(char *prog, int pipedef,
+pid_t pipespawnv_passwd(char *prog, int pipedef, int need_root,
int *stdinfd, int *stdoutfd, int *stderrfd,
char **my_argv);
pipespawn(
char * prog,
int pipedef,
+ int need_root,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
}
arglist_end(ap);
- pid = pipespawnv_passwd(prog, pipedef, stdinfd, stdoutfd, stderrfd, argv);
+ pid = pipespawnv_passwd(prog, pipedef, need_root,
+ stdinfd, stdoutfd, stderrfd, argv);
amfree(argv);
return pid;
}
pipespawnv(
char * prog,
int pipedef,
+ int need_root,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
char ** my_argv)
{
- return pipespawnv_passwd(prog, pipedef, stdinfd, stdoutfd, stderrfd,
+ return pipespawnv_passwd(prog, pipedef, need_root,
+ stdinfd, stdoutfd, stderrfd,
my_argv);
}
pipespawnv_passwd(
char * prog,
int pipedef,
+ int need_root,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
passwdvar = *my_argv++;
passwdfd = (int *)*my_argv++;
}
+ g_debug("pipespawnv: stdoutfd is %d", *stdoutfd);
memset(inpipe, -1, SIZEOF(inpipe));
memset(outpipe, -1, SIZEOF(outpipe));
memset(errpipe, -1, SIZEOF(errpipe));
safe_fd(-1, 0);
}
+ if (need_root)
+ become_root();
execve(prog, my_argv, env);
e = strerror(errno);
error(_("error [exec %s: %s]"), prog, e);