berkeley db4, for openldap server
[openwrt/svn-archive/openwrt.git] / obsolete-buildroot / sources / openwrt / patches / ppp / fix_closed_fds
1 sys_init() will open a socket and keep it open for the whole like of the
2 process. If pppd is started without all standard fds open then the socket
3 will get one of their numbers, which will be clobbered later by the
4 /dev/null fd duplicated by main().
5
6 See Debian bug #235192.
7
8 diff -ruN ppp.orig/pppd/main.c ppp/pppd/main.c
9 --- ppp.orig/pppd/main.c 2004-02-29 18:50:12.000000000 +0100
10 +++ ppp/pppd/main.c 2004-02-29 18:48:56.000000000 +0100
11 @@ -385,11 +385,6 @@
12 if (dryrun)
13 die(0);
14
15 - /*
16 - * Initialize system-dependent stuff.
17 - */
18 - sys_init();
19 -
20 /* Make sure fds 0, 1, 2 are open to somewhere. */
21 fd_devnull = open(_PATH_DEVNULL, O_RDWR);
22 if (fd_devnull < 0)
23 @@ -401,6 +396,11 @@
24 fd_devnull = i;
25 }
26
27 + /*
28 + * Initialize system-dependent stuff.
29 + */
30 + sys_init();
31 +
32 #ifdef USE_TDB
33 pppdb = tdb_open(_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
34 if (pppdb != NULL) {