diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-09-11 23:37:21 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-09-11 23:37:21 +0200 |
commit | 53f1e541f59da2049db1b2ba3e0b504f25fca7fb (patch) | |
tree | 738c27e0774ed124b7015705d87cafe51195b63a /src | |
parent | a3fbc8a1d14cd97eb9d59db2fcf9ce9fd4c64ec7 (diff) |
Don't fork for device configuration
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 21 |
1 files changed, 2 insertions, 19 deletions
@@ -329,7 +329,6 @@ static void at_child_exit(void) static void configure_device(int dev_id) { struct hci_dev_info di; - pid_t pid; int dd; if (hci_devinfo(dev_id, &di) < 0) @@ -338,25 +337,11 @@ static void configure_device(int dev_id) if (hci_test_bit(HCI_RAW, &di.flags)) return; - /* Do configuration in the separate process */ - pid = fork(); - switch (pid) { - case 0: - atexit(at_child_exit); - break; - case -1: - error("Fork failed. Can't init device hci%d: %s (%d)", - dev_id, strerror(errno), errno); - default: - debug("configuration child %d forked", pid); - return; - } - dd = hci_open_dev(dev_id); if (dd < 0) { error("Can't open device hci%d: %s (%d)", dev_id, strerror(errno), errno); - exit(1); + return; } /* Set device name */ @@ -400,8 +385,6 @@ static void configure_device(int dev_id) hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_PAGE_TIMEOUT, WRITE_PAGE_TIMEOUT_CP_SIZE, &cp); } - - exit(0); } static void init_device(int dev_id) @@ -421,7 +404,7 @@ static void init_device(int dev_id) error("Fork failed. Can't init device hci%d: %s (%d)", dev_id, strerror(errno), errno); default: - debug("initialization child %d forked", pid); + debug("child %d forked", pid); return; } |