From ba6b240655aea1321cb8528fdf7b5e9f4a9ed6c4 Mon Sep 17 00:00:00 2001 From: Jean Pierre TOSONI Date: Wed, 2 May 2018 12:02:34 -0700 Subject: 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 --- serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'serial.c') 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); -- cgit v1.2.1