X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Ftty.c;h=dcdb82514d377b614ab970af11289937653f735f;hb=96a47326d0073d66e287fb05fa34d119f46744ed;hp=efc92ec0fd34cbf8da3304c02db6ae70f8aa20e1;hpb=fc8efe940e9364ffd8d05023f0d96747f854388b;p=ppp.git diff --git a/pppd/tty.c b/pppd/tty.c index efc92ec..dcdb825 100644 --- a/pppd/tty.c +++ b/pppd/tty.c @@ -73,7 +73,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: tty.c,v 1.9 2002/12/06 12:06:45 paulus Exp $" +#define RCSID "$Id: tty.c,v 1.12 2003/04/07 00:01:46 paulus Exp $" #include #include @@ -614,6 +614,11 @@ int connect_tty() if (pipe(ipipe) < 0 || pipe(opipe) < 0) fatal("Couldn't create pipes for record option: %m"); + + /* don't leak these to the ptycommand */ + (void) fcntl(ipipe[0], F_SETFD, FD_CLOEXEC); + (void) fcntl(opipe[1], F_SETFD, FD_CLOEXEC); + ok = device_script(ptycommand, opipe[0], ipipe[1], 1) == 0 && start_charshunt(ipipe[0], opipe[1]); close(ipipe[0]); @@ -882,7 +887,7 @@ start_charshunt(ifd, ofd) { int cpid; - cpid = fork(); + cpid = safe_fork(); if (cpid == -1) { error("Can't fork process for character shunt: %m"); return 0; @@ -894,7 +899,6 @@ start_charshunt(ifd, ofd) if (getuid() != uid) fatal("setuid failed"); setgid(getgid()); - sys_close(); if (!nodetach) log_to_fd = -1; charshunt(ifd, ofd, record_file);