summaryrefslogtreecommitdiff
path: root/src/libtipidee/tipidee_rql_read.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-18 13:07:23 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-18 13:07:23 +0000
commit1a7e3d00588725da3d8764fa9d624bc8611be070 (patch)
tree65d28b52bd1d4ccdbeb418d4d681b1999ed46b7a /src/libtipidee/tipidee_rql_read.c
parent24fb88dbb023ae08adc9989bf19e0c6c569a6607 (diff)
downloadtipidee-1a7e3d00588725da3d8764fa9d624bc8611be070.tar.xz
Add infrastructure for custom error files
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libtipidee/tipidee_rql_read.c')
-rw-r--r--src/libtipidee/tipidee_rql_read.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libtipidee/tipidee_rql_read.c b/src/libtipidee/tipidee_rql_read.c
index fc99f37..fe6091d 100644
--- a/src/libtipidee/tipidee_rql_read.c
+++ b/src/libtipidee/tipidee_rql_read.c
@@ -66,8 +66,9 @@ static inline int get_version (char const *in, tipidee_rql *rql)
int tipidee_rql_read (buffer *b, char *buf, size_t max, size_t *w, tipidee_rql *rql, tain const *deadline, tain *stamp)
{
size_t pos[3] = { 0 } ;
- if (timed_getlnmax(b, buf, max, &pos[0], '\n', deadline, stamp) == -1)
- return errno == ETIMEDOUT ? 99 : -1 ;
+ ssize_t r = timed_getlnmax(b, buf, max, &pos[0], '\n', deadline, stamp) ;
+ if (r == -1) return errno == ETIMEDOUT ? 99 : -1 ;
+ if (!r) return 98 ;
buf[--pos[0]] = 0 ;
if (buf[pos[0] - 1] == '\r') buf[--pos[0]] = 0 ;
if (!rql_tokenize(buf, pos)) return 400 ;