$NetBSD: patch-ab,v 1.3 2004/07/10 21:00:00 wiz Exp $ --- src/task.c.orig 1999-02-18 00:32:18.000000000 +0100 +++ src/task.c @@ -5903,12 +5903,20 @@ task_daemonize __PF0(void) } /* Remove our association with a controling tty */ -#ifdef USE_SETPGRP +#if defined(USE_SETPGRP) || defined(USE_SETSID) +#if defined(USE_SETPGRP) t = setpgrp(); if (t < 0) { perror("task_daemonize: setpgrp"); exit(1); } +#else /* USE_SETPGRP */ + t = setsid(); + if (t < 0) { + perror("task_daemonize: setsid"); + exit(1); + } +#endif /* USE_SETPGRP */ task_signal_ignore(SIGHUP); @@ -5927,7 +5935,7 @@ task_daemonize __PF0(void) /* Parent */ exit(0); } -#else /* USE_SETPGRP */ +#else /* defined(USE_SETPGRP) || defined(USE_SETSID) */ t = setpgrp(0, getpid()); if (t < 0) { perror("task_daemonize: setpgrp"); @@ -5942,7 +5950,7 @@ task_daemonize __PF0(void) } (void) close(t); } -#endif /* USE_SETPGRP */ +#endif /* defined(USE_SETPGRP) || defined(USE_SETSID) */ } /* Close all open files */