mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-30 08:24:26 +00:00
Bugfix: Return failure, rather than quit, if BFwrite fails
This commit is contained in:
parent
4ba9006d0e
commit
06023e549e
@ -79,14 +79,18 @@ static void BFgets(char *buf, size_t bufLen, int fd)
|
|||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BFwrite(int fd, const void *buf, ssize_t bufLen)
|
static ssize_t BFwrite2(int fd, const void *buf, ssize_t bufLen)
|
||||||
{
|
{
|
||||||
ssize_t ret = write(fd, buf, bufLen);
|
return write(fd, buf, bufLen);
|
||||||
|
|
||||||
if (unlikely(ret != bufLen))
|
|
||||||
quit(1, "BFwrite failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BFwrite(fd, buf, bufLen) do { \
|
||||||
|
if ((bufLen) != BFwrite2(fd, buf, bufLen)) { \
|
||||||
|
applog(LOG_ERR, "Error writing to BitForce (" #buf ")"); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define BFclose(fd) close(fd)
|
#define BFclose(fd) close(fd)
|
||||||
|
|
||||||
static bool bitforce_detect_one(const char *devpath)
|
static bool bitforce_detect_one(const char *devpath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user