]> 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>
Tue, 2 Apr 2019 10:15:12 +0000 (12:15 +0200)
commit1cc0ae600f802f8350f883321c54512d1e9853ea
treeb543907a0844dad68add3609ca3211d86f1f80fa
parent498f5735ebe66e6023f401bd43a628af97e2e0cd
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