From 8158a34150250a5a46d7ad414aa52e600b3177cd Mon Sep 17 00:00:00 2001 From: Maksim Yevmenkin Date: Fri, 6 Mar 2009 01:34:30 +0000 Subject: MFC r188130 Clenup code a bit and do not call fork(2) before dameon(3) where not needed. --- usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c index 314149e29bc0..4e0d04bdc097 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.3