]> andersk Git - openssh.git/blobdiff - openbsd-compat/daemon.c
- halex@cvs.openbsd.org 2009/11/22 13:18:00
[openssh.git] / openbsd-compat / daemon.c
index 7d23b2467b949ee2cc2776ee362a16f9df49c919..3efe14c68c415b1639244e33b988b2c8bf9b94b3 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: daemon.c,v 1.6 2005/08/08 08:05:33 espie Exp $ */
 /*-
  * Copyright (c) 1990, 1993
  *     The Regents of the University of California.  All rights reserved.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * SUCH DAMAGE.
  */
 
+/* OPENBSD ORIGINAL: lib/libc/gen/daemon.c */
+
 #include "includes.h"
 
 #ifndef HAVE_DAEMON
 
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: daemon.c,v 1.2 1996/08/19 08:22:13 tholo Exp $";
-#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
+
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 int
-daemon(nochdir, noclose)
-       int nochdir, noclose;
+daemon(int nochdir, int noclose)
 {
        int fd;
 
@@ -49,18 +57,8 @@ daemon(nochdir, noclose)
        case -1:
                return (-1);
        case 0:
-#ifdef HAVE_CYGWIN
-               register_9x_service();
-#endif
                break;
        default:
-#ifdef HAVE_CYGWIN
-               /*
-                * This sleep avoids a race condition which kills the
-                * child process if parent is started by a NT/W2K service.
-                */
-               sleep(1);
-#endif
                _exit(0);
        }
 
This page took 0.036633 seconds and 4 git commands to generate.