From abbd94e0375300e8ae705ad80e74522864ccf302 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Fri, 30 Sep 1994 16:04:15 +0000 Subject: Formerly update.c.~2~ --- sutils/update.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'sutils') diff --git a/sutils/update.c b/sutils/update.c index 232373ac..07e38e41 100644 --- a/sutils/update.c +++ b/sutils/update.c @@ -18,9 +18,42 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include +#include +#include + +int main () { - daemon (0, 0); + int fd; + + switch (fork ()) + { + case -1: + perror ("Cannot fork"); + exit (1); + case 0: + break; + default: + _exit (0); + } + + if (setsid () == -1) + { + perror ("Cannot setsid"); + exit (1); + } + chdir ("/"); + + fd = open ("/dev/null", O_RDWR, 0); + if (fd != -1) + { + dup2 (fd, STDIN_FILENO); + dup2 (fd, STDOUT_FILENO); + dup2 (fd, STDERR_FILENO); + if (fd < STDERR_FILENO) + close (fd); + } for (;;) { -- cgit v1.2.3