we know how many file descriptors are available now
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 16 Jul 1988 00:22:18 +0000 (16:22 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 16 Jul 1988 00:22:18 +0000 (16:22 -0800)
SCCS-vsn: usr.sbin/sendmail/src/main.c 5.19

usr/src/usr.sbin/sendmail/src/main.c

index 6b3a81e..0cdb39e 100644 (file)
@@ -23,7 +23,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.18 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.19 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -146,10 +146,10 @@ main(argc, argv, envp)
        **      But also be sure that 0, 1, & 2 are open.
        */
 
        **      But also be sure that 0, 1, & 2 are open.
        */
 
-       i = open("/dev/null", 2);
+       i = open("/dev/null", O_RDWR);
        while (i >= 0 && i < 2)
                i = dup(i);
        while (i >= 0 && i < 2)
                i = dup(i);
-       for (i = 3; i < 50; i++)
+       for (i = getdtablesize(); i > 2; --i)
                (void) close(i);
        errno = 0;
 
                (void) close(i);
        errno = 0;