]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
lguest example launcher truncates block device file to 0 length on problems
authorChris Malley <mail@chrismalley.co.uk>
Wed, 26 Sep 2007 04:19:18 +0000 (14:19 +1000)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 26 Sep 2007 16:22:04 +0000 (09:22 -0700)
The function should also use ftruncate64() rather than ftruncate() to prevent
files over 4GB (not uncommon for a root filesystem) being zeroed.

Signed-off-by: Chris Malley <mail@chrismalley.co.uk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Documentation/lguest/lguest.c

index f7918401a0072c9b08bf81bb07434b66a96f6085..73c5f1f3d5d2e726c287396224df53cfca1bc65d 100644 (file)
@@ -882,7 +882,7 @@ static u32 handle_block_output(int fd, const struct iovec *iov,
                 * of the block file (possibly extending it). */
                if (off + len > device_len) {
                        /* Trim it back to the correct length */
-                       ftruncate(dev->fd, device_len);
+                       ftruncate64(dev->fd, device_len);
                        /* Die, bad Guest, die. */
                        errx(1, "Write past end %llu+%u", off, len);
                }