diff options
| author | Maksim Yevmenkin <emax@FreeBSD.org> | 2009-02-04 22:04:06 +0000 |
|---|---|---|
| committer | Maksim Yevmenkin <emax@FreeBSD.org> | 2009-02-04 22:04:06 +0000 |
| commit | d37245a0dea6ab123648a45c52b7abae7bf1302c (patch) | |
| tree | fe79fa257b8da5af41a6be92e335edf2f75cbfab /usr.sbin/bluetooth/hcseriald | |
| parent | a620f9a577d70bfa16890bb286fc2999612a6e03 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/bluetooth/hcseriald')
| -rw-r--r-- | usr.sbin/bluetooth/hcseriald/hcseriald.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.c b/usr.sbin/bluetooth/hcseriald/hcseriald.c index ee8d19c7a9955..b811c1db5f1fe 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 */ |
