| 1 | http://www.redhat.com/archives/fedora-extras-commits/2007-August/msg01642.html |
| 2 | |
| 3 | diff -Nru iputils-s20071127.orig/rdisc.c iputils-s20071127/rdisc.c |
| 4 | --- iputils-s20071127.orig/rdisc.c 2008-09-17 19:45:30.000000000 +0200 |
| 5 | +++ iputils-s20071127/rdisc.c 2008-09-17 19:52:03.000000000 +0200 |
| 6 | @@ -240,14 +240,25 @@ |
| 7 | { |
| 8 | int t; |
| 9 | pid_t pid; |
| 10 | + long open_max; |
| 11 | |
| 12 | if (trace) |
| 13 | return; |
| 14 | |
| 15 | + if ((open_max = sysconf(_SC_OPEN_MAX)) == -1) { |
| 16 | + if (errno == 0) { |
| 17 | + (void) fprintf(stderr, "OPEN_MAX is not supported\n"); |
| 18 | + } |
| 19 | + else { |
| 20 | + (void) fprintf(stderr, "sysconf() error\n"); |
| 21 | + } |
| 22 | + exit(1); |
| 23 | + } |
| 24 | + |
| 25 | if ((pid=fork()) != 0) |
| 26 | exit(0); |
| 27 | |
| 28 | - for (t = 0; t < OPEN_MAX; t++) |
| 29 | + for (t = 0; t < open_max; t++) |
| 30 | if (t != s) |
| 31 | close(t); |
| 32 | |