]> git.ozlabs.org Git - ppp.git/commitdiff
When using the notty option, close off stdin and stdout once the
authorPaul Mackerras <paulus@samba.org>
Fri, 12 Nov 2004 09:51:23 +0000 (09:51 +0000)
committerPaul Mackerras <paulus@samba.org>
Fri, 12 Nov 2004 09:51:23 +0000 (09:51 +0000)
charshunt has been started.  Also close off stderr unless it is the
log_to_fd.

pppd/tty.c

index 30d476559f6c32a3604f5495d90a4a54ac9ab005..991a148de0cfe1417a98d14dac16d8d3eeab1ebd 100644 (file)
@@ -68,7 +68,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: tty.c,v 1.19 2004/11/06 05:42:29 paulus Exp $"
+#define RCSID  "$Id: tty.c,v 1.20 2004/11/12 09:51:23 paulus Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -644,6 +644,12 @@ int connect_tty()
        } else if (notty) {
                if (!start_charshunt(0, 1))
                        goto errret;
+               dup2(fd_devnull, 0);
+               dup2(fd_devnull, 1);
+               if (log_to_fd == 1)
+                       log_to_fd = -1;
+               if (log_to_fd != 2)
+                       dup2(fd_devnull, 2);
        } else if (record_file != NULL) {
                int fd = dup(ttyfd);
                if (!start_charshunt(fd, fd))