linamh/sci-geosciences/gpsd/files/gpsd-2.33-duplicate-device-add-hang.patch
2008-12-08 19:43:30 +00:00

27 lines
1.1 KiB
Diff

If you try to add the same device twice with the hotplug script, gpsd does not
send any error back to the script, leading to it waiting forever on recv(), and
blocking gpsd from progressing in it's select loop.
This patch makes the daemon write back an error to the control socket (in
addition the the normal debug output), so that the hotplug script does not
block for the socket, and everything proceeds much better.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
diff -Nuar --exclude '*~' gpsd-2.33.orig/gpsd.c gpsd-2.33/gpsd.c
--- gpsd-2.33.orig/gpsd.c 2006-06-09 05:34:09.000000000 -0700
+++ gpsd-2.33/gpsd.c 2006-08-13 15:42:25.152204904 -0700
@@ -1048,9 +1048,10 @@
(void)write(sfd, "ERROR\n", 6);
} else if (buf[0] == '+') {
p = snarfline(buf+1, &stash);
- if (find_device(stash))
+ if (find_device(stash)) {
gpsd_report(1,"<= control(%d): %s already active \n", sfd, stash);
- else {
+ (void)write(sfd, "ERROR\n", 6);
+ } else {
gpsd_report(1,"<= control(%d): adding %s \n", sfd, stash);
if (open_device(stash))
(void)write(sfd, "OK\n", 3);