Commit c7de6939 authored by Milan Broz's avatar Milan Broz

Fix ioctl argument for block size check.

parent 2059266a
......@@ -53,14 +53,19 @@ static size_t device_block_size_fd(int fd, size_t *min_size)
{
struct stat st;
size_t bsize;
int arg;
if (fstat(fd, &st) < 0)
return 0;
if (S_ISREG(st.st_mode))
bsize = crypt_getpagesize();
else if (ioctl(fd, BLKSSZGET, &bsize) < 0)
return 0;
else {
if (ioctl(fd, BLKSSZGET, &arg) < 0)
bsize = crypt_getpagesize();
else
bsize = (size_t)arg;
}
if (!min_size)
return bsize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment