[patch 01/43] lguest: lguest example launcher truncates block device file to 0 length on problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
CC: Chris Malley <mail@xxxxxxxxxxxxxxxxx>

diff -r bcbb99849fd9 Documentation/lguest/lguest.c
--- a/Documentation/lguest/lguest.c	Wed Sep 26 12:21:40 2007 +1000
+++ b/Documentation/lguest/lguest.c	Wed Sep 26 14:15:38 2007 +1000
@@ -882,7 +882,7 @@ static u32 handle_block_output(int fd, c
 		 * 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);
 		}

--
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux