Commit aa723e7102b7ba057ccc3d516865e7a0c984a790

Con Kolivas 2012-07-13T10:54:06

Check return value of read in BFgets

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/driver-bitforce.c b/driver-bitforce.c
index c45b250..ae5b4ce 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -39,7 +39,7 @@ static void BFgets(char *buf, size_t bufLen, int fd)
 {
 	do
 		--bufLen;
-	while (likely(bufLen && read(fd, buf, 1) && (buf++)[0] != '\n'));
+	while (likely(bufLen && read(fd, buf, 1) == 1 && (buf++)[0] != '\n'));
 
 	buf[0] = '\0';
 }