gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] tests hanging on netsbd-6 i386


From: Greg Troxel
Subject: Re: [gpsd-dev] tests hanging on netsbd-6 i386
Date: Fri, 30 Jan 2015 12:06:37 -0500
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.4 (berkeley-unix)

I found the problem, sort of.  The following test makes the first two
tests pass (at release-3.11-311-g7de7d97) rather than hang.  This is
obviously not what should be committed, but somehow the pty is ending up
without NONBLOCK.

diff --git a/packet.c b/packet.c
index 02b18e5..8119d36 100644
--- a/packet.c
+++ b/packet.c
@@ -2096,11 +2096,22 @@ void packet_parse(struct gps_lexer_t *lexer)
 
 #undef getword
 
+#include <fcntl.h>
+
 ssize_t packet_get(int fd, struct gps_lexer_t *lexer)
 /* grab a packet; return -1=>I/O error, 0=>EOF, or a length */
 {
     ssize_t recvd;
 
+    {
+      int i = fcntl(fd, F_GETFL, 0);
+      if ((i & O_NONBLOCK) == 0) {
+       gpsd_report(&lexer->errout, LOG_ERROR,
+                   "packet_get: fd %d found without NONBLOCK", fd);
+       fcntl(fd, F_SETFL, O_NONBLOCK);
+      }
+    }
+
     /*@ -modobserver @*/
     errno = 0;
     recvd = read(fd, lexer->inbuffer + lexer->inbuflen,

Attachment: pgpWolOHPDFp5.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]