From 2c99851181a652358aa3ca58ef38c57e46ae02e4 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 12 Apr 2006 18:09:26 +0000 Subject: - patch from Denis Vlasenko to add and use bb_xdaemon() --- networking/dnsd.c | 5 ++--- networking/httpd.c | 4 ++-- networking/inetd.c | 3 ++- networking/telnetd.c | 6 ++---- 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'networking') diff --git a/networking/dnsd.c b/networking/dnsd.c index 9c5193820..d78ea04c0 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -5,6 +5,7 @@ * Copyright (C) 2005 Roberto A. Foglietta (me@roberto.foglietta.name) * Copyright (C) 2005 Odd Arild Olsen (oao at fibula dot no) * Copyright (C) 2003 Paul Sheer + * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. * * Odd Arild Olsen started out with the sheerdns [1] of Paul Sheer and rewrote @@ -408,9 +409,7 @@ int dnsd_main(int argc, char **argv) /* reexec for vfork() do continue parent */ vfork_daemon_rexec(1, 0, argc, argv, "-d"); #else /* uClinux */ - if (daemon(1, 0) < 0) { - bb_perror_msg_and_die("daemon"); - } + bb_xdaemon(1, 0); #endif /* uClinuvx */ dnsentryinit(is_verbose()); diff --git a/networking/httpd.c b/networking/httpd.c index fde8ae4bd..354c199e7 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* * httpd implementation for busybox * @@ -2114,8 +2115,7 @@ int httpd_main(int argc, char *argv[]) #if !ENABLE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY # if !DEBUG - if (daemon(1, 0) < 0) /* don`t change curent directory */ - bb_perror_msg_and_die("daemon"); + bb_xdaemon(1, 0); /* don`t change curent directory */ # endif return miniHttpd(server); #else diff --git a/networking/inetd.c b/networking/inetd.c index cc700832c..39a2b24cb 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -1314,7 +1314,7 @@ inetd_main (int argc, char *argv[]) /* reexec for vfork() do continue parent */ vfork_daemon_rexec (0, 0, argc, argv, "-f"); #else - daemon (0, 0); + daemon (0, 0); /* bb_xdaemon? */ #endif /* uClinux */ } else { setsid (); @@ -1802,3 +1802,4 @@ daytime_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED) (void) sendto (s, buffer, strlen (buffer), 0, &sa, sizeof (sa)); } #endif /* CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME */ +/* vi: set sw=4 ts=4: */ diff --git a/networking/telnetd.c b/networking/telnetd.c index 3e4b42cfa..d53f56b14 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -1,4 +1,4 @@ -/* vi:set ts=4:*/ +/* vi: set sw=4 ts=4: */ /* * Simple telnet server * Bjorn Wesen, Axis Communications AB (bjornw@axis.com) @@ -469,9 +469,7 @@ telnetd_main(int argc, char **argv) bb_perror_msg_and_die("listen"); } - if (daemon(0, 0) < 0) - bb_perror_msg_and_die("daemon"); - + bb_xdaemon(0, 0); maxfd = master_fd; #endif /* CONFIG_FEATURE_TELNETD_INETD */ -- cgit v1.2.3