Browse Source

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

nfactor-troky
Con Kolivas 13 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) @@ -252,7 +252,7 @@ _serial_read(int fd, char *buf, size_t bufsiz, char *eol)
ssize_t len, tlen = 0;
while (bufsiz) {
len = read(fd, buf, eol ? 1 : bufsiz);
if (len < 1)
if (unlikely(len == -1))
break;
tlen += len;
if (eol && *eol == buf[0])

Loading…
Cancel
Save