iputils/iputils-s20071127-rdisc_open_max.patch

29 lines
580 B
Diff
Raw Normal View History

--- iputils-s20071127/rdisc.c 2007-11-27 01:57:27.000000000 +0100
+++ iputils-s20071127/rdisc.c.fix 2009-04-30 23:57:12.000000000 +0200
@@ -240,14 +240,24 @@
{
int t;
pid_t pid;
+ long open_max;
if (trace)
return;
+ if ((open_max = sysconf(_SC_OPEN_MAX)) == -1) {
+ if (errno == 0) {
+ (void) fprintf(stderr, "OPEN_MAX is not supported\n");
+ }
+ else {
+ (void) fprintf(stderr, "sysconf() error\n");
+ }
+ exit(1);
+ }
if ((pid=fork()) != 0)
exit(0);
- for (t = 0; t < OPEN_MAX; t++)
+ for (t = 0; t < open_max; t++)
if (t != s)
close(t);