2 * Copyright (c) 1990, 1994 Regents of the University of Michigan.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of Michigan at Ann Arbor. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
16 #include <sys/types.h>
22 #include <sys/ioctl.h>
28 #endif /* USE_SYSCONF */
35 extern int ldap_debug;
39 nbits = sysconf( _SC_OPEN_MAX );
40 #else /* USE_SYSCONF */
41 nbits = getdtablesize();
42 #endif /* USE_SYSCONF */
45 if ( nbits > FD_SETSIZE ) {
48 #endif /* FD_SETSIZE */
51 if ( ldap_debug == 0 ) {
53 for ( i = 0; i < 5; i++ ) {
54 #if defined( sunos5 ) && defined( THREAD_SUNOS5_LWP )
73 for ( i = 3; i < nbits; i++ )
79 if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) {
80 perror( "/dev/null" );
93 #else /* USE_SETSID */
94 if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) {
95 (void) ioctl( sd, TIOCNOTTY, NULL );
98 #endif /* USE_SETSID */
103 (void) SIGNAL( SIGPIPE, SIG_IGN );