switch( pid = fork() ) {
case 0: /* child */
- close( s );
+ tcp_close( s );
do_queries( ns );
break;
break;
default: /* parent */
- close( ns );
+ tcp_close( ns );
if ( debug )
fprintf( stderr, "forked child %d\n", pid );
break;
do_queries( 0 );
- close( 0 );
+ tcp_close( 0 );
exit( 0 );
}
switch( pid = fork() ) {
case 0: /* child */
- close( s );
+ tcp_close( s );
do_queries( ns );
break;
break;
default: /* parent */
- close( ns );
+ tcp_close( ns );
if ( debug )
fprintf( stderr, "forked child %d\n", pid );
break;
#define MAXHOSTNAMELEN 64
#endif
-#ifdef MACOS
-#define tcp_close( s ) tcpclose( s )
-#else /* MACOS */
-#ifdef DOS
-#ifdef PCNFS
-#define tcp_close( s ) close( s )
-#endif /* PCNFS */
-#ifdef NCSA
-#define tcp_close( s ) netclose( s ); netshut()
-#endif /* NCSA */
-#ifdef WINSOCK
-#define tcp_close( s ) closesocket( s );
-#endif /* WINSOCK */
-#else /* DOS */
-#define tcp_close( s ) close( s )
-#endif /* DOS */
+#ifdef HAVE_WINSOCK
+# define tcp_close( s ) closesocket( s );
+# define ioctl( s, c, a ) ioctlsocket( (s), (c), (a) )
+#elif MACOS
+# define tcp_close( s ) tcpclose( s )
+#elif DOS
+# ifdef PCNFS
+# define tcp_close( s ) close( s )
+# endif /* PCNFS */
+# ifdef NCSA
+# define tcp_close( s ) do { netclose( s ); netshut() } while(0)
+# endif /* NCSA */
+#else
+# define tcp_close( s ) close( s )
#endif /* MACOS */
#if !defined(__alpha) || defined(VMS)
}
#ifdef FIONBIO
if (lber_pvt_sb_in_use(sb)) {
- int status = (nb!=0);
- if (ioctl( lber_pvt_sb_get_desc(sb), FIONBIO, (caddr_t)&status ) == -1 ) {
+ /* WINSOCK requires the status to be a long */
+ u_long status = (nb!=0);
+ if (ioctl( lber_pvt_sb_get_desc(sb), FIONBIO, &status ) == -1 ) {
return -1;
}
}
sock.sin_family = AF_INET;
sock.sin_port = 0;
if ( bind(s, (struct sockaddr *) &sock, sizeof(sock)) < 0) {
- close( s );
+ tcp_close( s );
return( NULL );
}
if (( ld = ldap_init( host, port )) == NULL ) {
- close( s );
+ tcp_close( s );
return( NULL );
}
inet_ntoa( from.sin_addr ) );
}
- close(ns);
+ tcp_close(ns);
continue;
}
#endif /* TCP_WRAPPERS */
#ifdef VMS
/* This is for debug on terminal on VMS */
- close( tcps );
+ tcp_close( tcps );
#ifdef LDAP_PROCTITLE
setproctitle( hp == NULL ? inet_ntoa( from.sin_addr ) :
hp->h_name );
switch( pid = fork() ) {
case 0: /* child */
- close( tcps );
+ tcp_close( tcps );
#ifdef LDAP_PROCTITLE
sprintf( title, "%s (%d)\n", hp == NULL ?
inet_ntoa( from.sin_addr ) : hp->h_name,
#ifdef LDAP_DEBUG
if ( ldap_debug ) perror( "fork" );
#endif
- close( ns );
+ tcp_close( ns );
syslog( LOG_ERR, "fork failed %m" );
/* let things cool off */
sleep( 15 );
break;
default: /* parent */
- close( ns );
+ tcp_close( ns );
Debug( LDAP_DEBUG_TRACE, "forked child %d\n", pid, 0,
0 );
break;
slapd_remove(s);
Debug( LDAP_DEBUG_CONNS, "daemon: closing %d\n", s, 0, 0 );
- close(s);
+ tcp_close(s);
}
static void *
Debug( LDAP_DEBUG_ANY,
"daemon: %d beyond descriptor table size %d\n",
s, dtblsize, 0 );
- close(s);
+ tcp_close(s);
continue;
}
#endif
client_addr == NULL ? "unknown" : client_addr,
0, 0 );
- close(s);
+ tcp_close(s);
continue;
}
#endif /* HAVE_TCPD */
s,
client_name == NULL ? "unknown" : client_name,
client_addr == NULL ? "unknown" : client_addr);
- close(s);
+ tcp_close(s);
continue;
}
}
if( tcps >= 0 ) {
- close( tcps );
+ tcp_close( tcps );
}
ldap_pvt_thread_mutex_lock( &active_threads_mutex );