diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-03-24 18:36:22 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-03-24 18:36:22 -0400 |
commit | 85453a3967a4c2d2337bb5ecc8f84a341f61dca5 (patch) | |
tree | 2937d9487f3d1d701b8c8676550486c7d42ddcd3 /gpsd.c | |
parent | e4c54e75b8c915797234e1eae01a0ba4d5785b78 (diff) | |
download | gpsd-85453a3967a4c2d2337bb5ecc8f84a341f61dca5.tar.gz |
Finally get the device open where we want it, in the awaken() function.
All regression tests pass.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -710,7 +710,15 @@ static bool add_device(char *device_name) static bool awaken(struct subscriber_t *user, struct gps_device_t *device) /* awaken a device and notify all watchers*/ { - /* and open that device */ + /* open that device */ + if (!initialized_device(device)) { + if (!open_device(device->gpsdata.dev.path)) { + gpsd_report(LOG_PROG, "allocation_filter: open failed\n"); + free_device(device); + return false; + } + } + if (device->gpsdata.gps_fd != -1) { gpsd_report(LOG_PROG,"client(%d): device %d (fd=%d, path %s) already active.\n", sub_index(user), @@ -816,14 +824,6 @@ static /*@null@*/struct channel_t *assign_channel(struct subscriber_t *user, } } - if (!initialized_device(channel->device)) { - if (!open_device(channel->device->gpsdata.dev.path)) { - gpsd_report(LOG_PROG, "allocation_filter: open failed\n"); - free_device(channel->device); - return false; - } - } - if (channel->device == NULL) { return NULL; } |