Use string comparison functions elsewhere in bitforce code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/driver-bitforce.c b/driver-bitforce.c
index 7e8296e..7cc4189 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -269,12 +269,12 @@ re_send:
else
BFwrite(fdDev, "ZDX", 3);
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
- if (!pdevbuf[0] || (pdevbuf[0] == 'B')) {
+ if (!pdevbuf[0] || !strncasecmp(pdevbuf, "B", 1)) {
mutex_unlock(&bitforce->device_mutex);
bitforce->wait_ms += WORK_CHECK_INTERVAL_MS;
usleep(WORK_CHECK_INTERVAL_MS * 1000);
goto re_send;
- } else if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
+ } else if (unlikely(strncasecmp(pdevbuf, "OK", 2))) {
mutex_unlock(&bitforce->device_mutex);
if (bitforce->nonce_range) {
applog(LOG_DEBUG, "BFL%i: Disabling nonce range support", bitforce->device_id);
@@ -320,7 +320,7 @@ re_send:
return false;
}
- if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
+ if (unlikely(strncasecmp(pdevbuf, "OK", 2))) {
applog(LOG_ERR, "BFL%i: Error: Send block data reports: %s", bitforce->device_id, pdevbuf);
return false;
}
@@ -403,7 +403,7 @@ static uint64_t bitforce_get_result(struct thr_info *thr, struct work *work)
}
submit_nonce(thr, work, nonce);
- if (pnoncebuf[8] != ',')
+ if (strncmp(&pnoncebuf[8], ",", 1))
break;
pnoncebuf += 9;
}