summaryrefslogtreecommitdiff
path: root/usr.sbin/bluetooth
diff options
context:
space:
mode:
authorMaksim Yevmenkin <emax@FreeBSD.org>2009-02-04 22:04:06 +0000
committerMaksim Yevmenkin <emax@FreeBSD.org>2009-02-04 22:04:06 +0000
commitd37245a0dea6ab123648a45c52b7abae7bf1302c (patch)
treefe79fa257b8da5af41a6be92e335edf2f75cbfab /usr.sbin/bluetooth
parenta620f9a577d70bfa16890bb286fc2999612a6e03 (diff)
Notes
Diffstat (limited to 'usr.sbin/bluetooth')
-rw-r--r--usr.sbin/bluetooth/hcsecd/hcsecd.c5
-rw-r--r--usr.sbin/bluetooth/hcseriald/hcseriald.c21
-rw-r--r--usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c20
3 files changed, 10 insertions, 36 deletions
diff --git a/usr.sbin/bluetooth/hcsecd/hcsecd.c b/usr.sbin/bluetooth/hcsecd/hcsecd.c
index de7a77581b13..72f9c8cb8fdf 100644
--- a/usr.sbin/bluetooth/hcsecd/hcsecd.c
+++ b/usr.sbin/bluetooth/hcsecd/hcsecd.c
@@ -128,9 +128,8 @@ main(int argc, char *argv[])
(void * const) &filter, sizeof(filter)) < 0)
err(1, "Could not set HCI socket filter");
- if (detach)
- if (daemon(0, 0) < 0)
- err(1, "Could not daemon()ize");
+ if (detach && daemon(0, 0) < 0)
+ err(1, "Could not daemon()ize");
openlog(HCSECD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON);
diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.c b/usr.sbin/bluetooth/hcseriald/hcseriald.c
index ee8d19c7a995..b811c1db5f1f 100644
--- a/usr.sbin/bluetooth/hcseriald/hcseriald.c
+++ b/usr.sbin/bluetooth/hcseriald/hcseriald.c
@@ -101,23 +101,10 @@ main(int argc, char *argv[])
/* Open device */
n = open_device(device, speed, name);
- if (detach) {
- pid_t pid = fork();
-
- if (pid == (pid_t) -1) {
- syslog(LOG_ERR, "Could not fork(). %s (%d)",
- strerror(errno), errno);
- exit(1);
- }
-
- if (pid != 0)
- exit(0);
-
- if (daemon(0, 0) < 0) {
- syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
- strerror(errno), errno);
- exit(1);
- }
+ if (detach && daemon(0, 0) < 0) {
+ syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
+ strerror(errno), errno);
+ exit(1);
}
/* Write PID file */
diff --git a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c
index cea2e3b1ca75..956dc4d83839 100644
--- a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c
+++ b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c
@@ -166,22 +166,10 @@ main(int argc, char *argv[])
openlog(RFCOMM_PPPD, LOG_PID | LOG_PERROR | LOG_NDELAY, LOG_USER);
- if (detach) {
- pid = fork();
- if (pid == (pid_t) -1) {
- syslog(LOG_ERR, "Could not fork(). %s (%d)",
- strerror(errno), errno);
- exit(1);
- }
-
- if (pid != 0)
- exit(0);
-
- if (daemon(0, 0) < 0) {
- syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
- strerror(errno), errno);
- exit(1);
- }
+ if (detach && daemon(0, 0) < 0) {
+ syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
+ strerror(errno), errno);
+ exit(1);
}
s = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);