summaryrefslogtreecommitdiff
path: root/ppsthread.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2016-04-24 19:33:30 -0700
committerGary E. Miller <gem@rellim.com>2016-04-24 19:33:30 -0700
commit10526aec7c10ee41f314a3863af73e3250b82629 (patch)
tree44c6f77d66bbdeb8352bf888965c87230e601286 /ppsthread.c
parent55fa931669b3544768237d9d6b5411d3ae4fcd47 (diff)
downloadgpsd-10526aec7c10ee41f314a3863af73e3250b82629.tar.gz
Improve the test for TIOMCIWAIT, log it better.
If the file descriptor is negative, no way it can be a tty.
Diffstat (limited to 'ppsthread.c')
-rw-r--r--ppsthread.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ppsthread.c b/ppsthread.c
index b0b5303a..7a82cceb 100644
--- a/ppsthread.c
+++ b/ppsthread.c
@@ -653,9 +653,10 @@ static void *gpsd_ppsmonitor(void *arg)
* TIOMCIWAIT, which is linux specifix
* RFC2783, a.k.a kernel PPS (KPPS)
* or if KPPS is deficient a combination of the two */
- if ( isatty(thread_context->devicefd) == 0 ) {
- thread_context->log_hook(thread_context, THREAD_INF,
- "KPPS:%s gps_fd:%d not a tty\n",
+ if ( 0 > thread_context->devicefd
+ || 0 == isatty(thread_context->devicefd) ) {
+ thread_context->log_hook(thread_context, THREAD_PROG,
+ "KPPS:%s gps_fd:%d not a tty, can not use TIOMCIWAIT\n",
thread_context->devicename,
thread_context->devicefd);
/* why do we care the device is a tty? so as not to ioctl(TIO..)