]> git.ipfire.org Git - thirdparty/util-linux.git/commit
losetup: use offset in warn_size() calculation
authorKarel Zak <kzak@redhat.com>
Fri, 18 Jan 2019 11:13:12 +0000 (12:13 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 18 Jan 2019 11:13:12 +0000 (12:13 +0100)
commit6daf185c3cc2b7c4b85f8dd39c9caaab5caea434
tree8b4e1b0c65d55c093d8e68448ec13a42e0dd6d1f
parent8a74df7f74544ea7d8c3e564665803c68d5c32c1
losetup: use offset in warn_size() calculation

 # dd if=/dev/urandom of=dummy bs=513 count=1 2>/dev/null

 # losetup -f --show --offset 1 dummy
 /dev/loop0
 losetup: dummy: Warning: file does not fit into a 512-byte sector; the end of the file will be ignore

The warning is bogus as with offset the size of the file fits into
512-byte sector. Simple test that all is right:

 # dd if=dummy bs=1 skip=1 2>/dev/null | sha256sum - /dev/loop0
 da2ed0ade6ea518a802cd8a7a3c01c408ad8699ef6856b0b01f92b867d4ba9b5  -
 da2ed0ade6ea518a802cd8a7a3c01c408ad8699ef6856b0b01f92b867d4ba9b5  /dev/loop0

Addresses: https://github.com/karelzak/util-linux/issues/722
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/losetup.c