~mdw
/
tripe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use new mdup(3mLib) function.
[tripe]
/
server
/
privsep.c
diff --git
a/server/privsep.c
b/server/privsep.c
index
5bc2b89
..
bbd4814
100644
(file)
--- a/
server/privsep.c
+++ b/
server/privsep.c
@@
-173,6
+173,7
@@
void ps_split(int detachp)
{
pid_t kid;
int fd[2];
{
pid_t kid;
int fd[2];
+ mdup_fd md[1];
const char *helper;
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fd)) {
const char *helper;
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fd)) {
@@
-189,8
+190,9
@@
void ps_split(int detachp)
if (kid == 0) {
signal(SIGCHLD, SIG_DFL);
if (detachp) detachtty();
if (kid == 0) {
signal(SIGCHLD, SIG_DFL);
if (detachp) detachtty();
- if (dup2(fd[0], 0) < 0) goto lose;
- close(fd[0]); close(fd[1]);
+ close(fd[1]);
+ md[0].cur = fd[0]; md[0].want = STDIN_FILENO;
+ if (mdup(md, 1)) goto lose;
execl(helper, helper, (char *)0);
lose:
fprintf(stderr, "helper: failed to run helper: %s\n", strerror(errno));
execl(helper, helper, (char *)0);
lose:
fprintf(stderr, "helper: failed to run helper: %s\n", strerror(errno));