diff options
author | emax <emax@FreeBSD.org> | 2009-02-04 22:04:06 +0000 |
---|---|---|
committer | emax <emax@FreeBSD.org> | 2009-02-04 22:04:06 +0000 |
commit | ebea9bff1dbd39061821016995df2ed6229638fe (patch) | |
tree | fe79fa257b8da5af41a6be92e335edf2f75cbfab /usr.bin/bluetooth | |
parent | f0da128350a84dfa9167374bf7dcbc4f03500c6a (diff) | |
download | FreeBSD-src-ebea9bff1dbd39061821016995df2ed6229638fe.zip FreeBSD-src-ebea9bff1dbd39061821016995df2ed6229638fe.tar.gz |
Clenup code a bit and do not call fork(2) before dameon(3) where not needed.
MFC after: 1 month
Diffstat (limited to 'usr.bin/bluetooth')
-rw-r--r-- | usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c | 18 |
1 files changed, 2 insertions, 16 deletions
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"); |