]>
Commit | Line | Data |
---|---|---|
df92424c MT |
1 | diff -up iputils-s20071127/rdisc.c.open_max iputils-s20071127/rdisc.c |
2 | --- iputils-s20071127/rdisc.c.open_max 2008-02-25 11:15:37.000000000 +0100 | |
3 | +++ iputils-s20071127/rdisc.c 2008-02-25 11:17:30.000000000 +0100 | |
4 | @@ -240,14 +240,25 @@ void do_fork(void) | |
5 | { | |
6 | int t; | |
7 | pid_t pid; | |
8 | + long open_max; | |
9 | ||
10 | if (trace) | |
11 | return; | |
12 | + if ((open_max = sysconf(_SC_OPEN_MAX)) == -1) { | |
13 | + if (errno == 0) { | |
14 | + (void) fprintf(stderr, "OPEN_MAX is not supported\n"); | |
15 | + } | |
16 | + else { | |
17 | + (void) fprintf(stderr, "sysconf() error\n"); | |
18 | + } | |
19 | + exit(1); | |
20 | + } | |
21 | + | |
22 | ||
23 | if ((pid=fork()) != 0) | |
24 | exit(0); | |
25 | ||
26 | - for (t = 0; t < OPEN_MAX; t++) | |
27 | + for (t = 0; t < open_max; t++) | |
28 | if (t != s) | |
29 | close(t); | |
30 |