summaryrefslogtreecommitdiff
path: root/obsolete-buildroot/sources/openwrt/patches/ppp/fix_closed_fds
blob: 39208ab4db04d1d8af10bba332f07b5665186f36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
sys_init() will open a socket and keep it open for the whole like of the
process. If pppd is started without all standard fds open then the socket
will get one of their numbers, which will be clobbered later by the
/dev/null fd duplicated by main().

See Debian bug #235192.

diff -ruN ppp.orig/pppd/main.c ppp/pppd/main.c
--- ppp.orig/pppd/main.c	2004-02-29 18:50:12.000000000 +0100
+++ ppp/pppd/main.c	2004-02-29 18:48:56.000000000 +0100
@@ -385,11 +385,6 @@
     if (dryrun)
 	die(0);
 
-    /*
-     * Initialize system-dependent stuff.
-     */
-    sys_init();
-
     /* Make sure fds 0, 1, 2 are open to somewhere. */
     fd_devnull = open(_PATH_DEVNULL, O_RDWR);
     if (fd_devnull < 0)
@@ -401,6 +396,11 @@
 	fd_devnull = i;
     }
 
+    /*
+     * Initialize system-dependent stuff.
+     */
+    sys_init();
+
 #ifdef USE_TDB
     pppdb = tdb_open(_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
     if (pppdb != NULL) {