util: fix return code checks in dev_get_blocklen
The ioctl() calls in dev_get_blocklen() were checking for != 0 instead of == 0, so the default path (512) was always being taken. Change-Id: Ib0b016b1d453fb94d408063417b7485ff24ed220 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
c9cc869a3e
commit
ae80d88bcb
@ -67,13 +67,13 @@ dev_get_blocklen(int fd)
|
|||||||
#if defined(DKIOCGETBLOCKSIZE) /* FreeBSD */
|
#if defined(DKIOCGETBLOCKSIZE) /* FreeBSD */
|
||||||
uint32_t blocklen;
|
uint32_t blocklen;
|
||||||
|
|
||||||
if (ioctl(fd, DKIOCGETBLOCKSIZE, &blocklen) != 0) {
|
if (ioctl(fd, DKIOCGETBLOCKSIZE, &blocklen) == 0) {
|
||||||
return blocklen;
|
return blocklen;
|
||||||
}
|
}
|
||||||
#elif defined(__linux__) && defined(BLKSSZGET)
|
#elif defined(__linux__) && defined(BLKSSZGET)
|
||||||
uint32_t blocklen;
|
uint32_t blocklen;
|
||||||
|
|
||||||
if (ioctl(fd, BLKSSZGET, &blocklen) != 0) {
|
if (ioctl(fd, BLKSSZGET, &blocklen) == 0) {
|
||||||
return blocklen;
|
return blocklen;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user