Commit 6eee0e3874b2cecfd30fbaf2ed191501c5f256df

ckolivas 2012-02-04T10:34:37

Fix warnings in bitforce.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/bitforce.c b/bitforce.c
index b041aea..619dcbf 100644
--- a/bitforce.c
+++ b/bitforce.c
@@ -60,9 +60,14 @@ static void BFgets(char *buf, size_t bufLen, int fd)
 	buf[0] = '\0';
 }
 
-#define BFwrite(fd, buf, bufLen) write(fd, buf, bufLen)
-#define BFclose(fd) close(fd)
+static void BFwrite(int fd, const void *buf, size_t bufLen)
+{
+	ssize_t ret = write(fd, buf, bufLen);
+	if (unlikely(ret != bufLen))
+		quit(1, "BFwrite failed");
+}
 
+#define BFclose(fd) close(fd)
 
 static bool bitforce_detect_one(const char *devpath)
 {