Skip to content

Commit e1a70f2

Browse files
committed
aio: fix edge cases with error on blocking read
Signed-off-by: Steve Bennett <[email protected]>
1 parent 4236d80 commit e1a70f2

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

jim-aio.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,7 @@ static int aio_read_len(Jim_Interp *interp, AioFile *af, int nb, char *buf, size
816816
if (JimCheckStreamError(interp, af)) {
817817
return JIM_ERR;
818818
}
819-
if (nb || af->timeout) {
820-
return JIM_OK;
821-
}
819+
break;
822820
}
823821

824822
return JIM_OK;
@@ -1105,14 +1103,9 @@ static int aio_cmd_gets(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
11051103
offset = len;
11061104
len = af->fops->reader(af, buf, AIO_BUF_LEN, nb);
11071105
if (len <= 0) {
1108-
if (nb || af->timeout) {
1109-
/* Stop when no more to read (non-blocking) or timeout and return an empty string */
1110-
break;
1111-
}
1112-
}
1113-
else {
1114-
Jim_AppendString(interp, af->readbuf, buf, len);
1106+
break;
11151107
}
1108+
Jim_AppendString(interp, af->readbuf, buf, len);
11161109
}
11171110

11181111
aio_set_nonblocking(af, nb);

0 commit comments

Comments
 (0)