Permalink
Browse files

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

  • Loading branch information...
1 parent a916be0 commit 035ccdf1586a3cb2936c7973b6433cacca87d8cf @ckolivas committed Aug 17, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 fpgautils.c
View
@@ -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])

0 comments on commit 035ccdf

Please sign in to comment.