Browse Source

0 is a valid return value for read so only break out if read returns -1.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
035ccdf158
  1. 2
      fpgautils.c

2
fpgautils.c

@ -252,7 +252,7 @@ _serial_read(int fd, char *buf, size_t bufsiz, char *eol)
ssize_t len, tlen = 0; ssize_t len, tlen = 0;
while (bufsiz) { while (bufsiz) {
len = read(fd, buf, eol ? 1 : bufsiz); len = read(fd, buf, eol ? 1 : bufsiz);
if (len < 1) if (unlikely(len == -1))
break; break;
tlen += len; tlen += len;
if (eol && *eol == buf[0]) if (eol && *eol == buf[0])

Loading…
Cancel
Save