summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorJean Pierre TOSONI <jp.tosoni@acksys.fr>2018-05-02 12:02:34 -0700
committerGary E. Miller <gem@rellim.com>2018-05-02 12:02:34 -0700
commitba6b240655aea1321cb8528fdf7b5e9f4a9ed6c4 (patch)
tree0aadd57fbc54bc78c8aa912d5660da9d39ea0156 /serial.c
parent9429b1a5498e0e1ea68d5e53245c897dda52e5aa (diff)
downloadgpsd-ba6b240655aea1321cb8528fdf7b5e9f4a9ed6c4.tar.gz
The Quectel EC25 device used with the Linux 3.10.20 usb/option driver
makes gpsd hang when it closes the serial port after receiving a SIGTERM. Hanging is caused by the call to tcdrain(), which happens even when gpsd is in read-only mode (-b argument). In this mode, since nothing is ever written to the serial port, the tcdrain call is not needed. Skip it. Signed-off-by: Gary E. Miller <gem@rellim.com>
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/serial.c b/serial.c
index 2c171f21..22b688d0 100644
--- a/serial.c
+++ b/serial.c
@@ -728,7 +728,8 @@ void gpsd_close(struct gps_device_t *session)
#ifdef TIOCNXCL
(void)ioctl(session->gpsdata.gps_fd, (unsigned long)TIOCNXCL);
#endif /* TIOCNXCL */
- (void)tcdrain(session->gpsdata.gps_fd);
+ if (!session->context->readonly)
+ (void)tcdrain(session->gpsdata.gps_fd);
if (isatty(session->gpsdata.gps_fd) != 0) {
/* force hangup on close on systems that don't do HUPCL properly */
(void)cfsetispeed(&session->ttyset, (speed_t) B0);