diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-01-13 01:42:35 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-01-13 01:42:35 +0000 |
commit | 7d31883b70f908a7e828d9d7b55f3248d024c1df (patch) | |
tree | 8e914135a505c8ab4a734b45deab7133e6210eae /gpspacket.c | |
parent | ddd2290db0aace128e0e486eaefba2149c5f595c (diff) | |
download | gpsd-7d31883b70f908a7e828d9d7b55f3248d024c1df.tar.gz |
Fix buggy termination test,
Diffstat (limited to 'gpspacket.c')
-rw-r--r-- | gpspacket.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gpspacket.c b/gpspacket.c index 69d16fae..2d811a26 100644 --- a/gpspacket.c +++ b/gpspacket.c @@ -71,17 +71,19 @@ Lexer_init(LexerObject *self) static PyObject * Lexer_get(LexerObject *self, PyObject *args) { - ssize_t len; + ssize_t len, waiting; int fd; if (!PyArg_ParseTuple(args, "i;missing or invalid file descriptor argument to gpspacket.get", &fd)) return NULL; + waiting = packet_buffered_input(&self->lexer); + len = packet_get(fd, &self->lexer); if (PyErr_Occurred()) return NULL; - if (len == 0) { + if (len <= 0 && waiting <= 0) { self->lexer.type = EMPTY_PACKET; self->lexer.outbuffer[0] = '\0'; self->lexer.outbuflen = 0; |