diff options
author | Karel Zak | 2011-06-27 15:57:14 +0200 |
---|---|---|
committer | Karel Zak | 2011-06-27 15:57:45 +0200 |
commit | 6678c06f5d15814a982397977c7e9f14c219137f (patch) | |
tree | f6b84bf7d87f158b17a1846d2d5866960101fa0d | |
parent | lib: [blkdev.c] add blkdev_get_physector_size() (diff) | |
download | kernel-qcow2-util-linux-6678c06f5d15814a982397977c7e9f14c219137f.tar.gz kernel-qcow2-util-linux-6678c06f5d15814a982397977c7e9f14c219137f.tar.xz kernel-qcow2-util-linux-6678c06f5d15814a982397977c7e9f14c219137f.zip |
lib: [blkdev.c] more robust blkdev_is_misaligned()
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | lib/blkdev.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/blkdev.c b/lib/blkdev.c index b6f9bfd32..d889b787f 100644 --- a/lib/blkdev.c +++ b/lib/blkdev.c @@ -240,7 +240,11 @@ int blkdev_is_misaligned(int fd) if (ioctl(fd, BLKALIGNOFF, &aligned) < 0) return 0; /* probably kernel < 2.6.32 */ - return aligned; + /* + * Note that kernel returns -1 as alignement offset if no compatible + * sizes and alignments exist for stacked devices + */ + return aligned != 0 ? 1 : 0; #else return 0; #endif |