]> git.sur5r.net Git - openldap/blobdiff - libraries/liblutil/detach.c
close registry, and return static pointer (no free) from getRegParam
[openldap] / libraries / liblutil / detach.c
index 1ca3f84be9cce7b57c83923ae18a3bcb0e4872cd..682410d42191a5caab45efdb44b02ee62e83ef2b 100644 (file)
 #include <stdio.h>
 
 #include <ac/signal.h>
+#include <ac/socket.h>
 #include <ac/unistd.h>
 
-#include <sys/types.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"
 
-/* I'd really like to make do_close an fd_set, but that isn't portable. */
 void
 lutil_detach( int debug, int do_close )
 {
@@ -84,13 +88,15 @@ lutil_detach( int debug, int do_close )
 
 #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
 }