+/* $OpenLDAP$ */
/*
* Copyright (c) 1990, 1994 Regents of the University of Michigan.
* All rights reserved.
#include <stdio.h>
+#include <ac/stdlib.h>
#include <ac/signal.h>
+#include <ac/socket.h>
#include <ac/unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include "lutil.h"
break;
default:
- _exit( 0 );
+ _exit( EXIT_SUCCESS );
}
break;
}
if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) {
perror( "/dev/null" );
- exit( 1 );
+ exit( EXIT_FAILURE );
}
for ( i = 0; i < 3; i++ )
if ( sd != i && isatty( i ) )
#ifdef HAVE_SETSID
(void) setsid();
-#else /* HAVE_SETSID */
+#elif TIOCNOTTY
if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) {
(void) ioctl( sd, TIOCNOTTY, NULL );
(void) close( sd );
}
-#endif /* HAVE_SETSID */
+#endif
}
+#ifdef SIGPIPE
(void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
}