Merge "liblp: Handle invalid alignment offsets correctly."

This commit is contained in:
David Anderson 2019-06-20 19:09:52 +00:00 committed by Gerrit Code Review
commit 99f610da3d

View file

@ -64,6 +64,12 @@ bool GetBlockDeviceInfo(const std::string& block_device, BlockDeviceInfo* device
PERROR << __PRETTY_FUNCTION__ << "BLKALIGNOFF failed on " << block_device;
return false;
}
// The kernel can return -1 here when misaligned devices are stacked (i.e.
// device-mapper).
if (alignment_offset == -1) {
alignment_offset = 0;
}
int logical_block_size;
if (ioctl(fd, BLKSSZGET, &logical_block_size) < 0) {
PERROR << __PRETTY_FUNCTION__ << "BLKSSZGET failed on " << block_device;