From ebea9bff1dbd39061821016995df2ed6229638fe Mon Sep 17 00:00:00 2001 From: emax Date: Wed, 4 Feb 2009 22:04:06 +0000 Subject: Clenup code a bit and do not call fork(2) before dameon(3) where not needed. MFC after: 1 month --- usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'usr.bin/bluetooth') diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c index 314149e..4e0d04b 100644 --- a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c +++ b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c @@ -281,22 +281,8 @@ main(int argc, char *argv[]) } /* Became daemon if required */ - if (background) { - switch (fork()) { - case -1: - err(1, "Could not fork()"); - /* NOT REACHED */ - - case 0: - exit(0); - /* NOT REACHED */ - - default: - if (daemon(0, 0) < 0) - err(1, "Could not daemon()"); - break; - } - } + if (background && daemon(0, 0) < 0) + err(1, "Could not daemon()"); openlog(SPPD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "Starting on %s...", (tty != NULL)? tty : "stdin/stdout"); -- cgit v1.1