public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lguest example launcher truncates block device file to 0 length on problems
@ 2007-09-26  4:19 Rusty Russell
  0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2007-09-26  4:19 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lkml - Kernel Mailing List, lguest, Chris Malley

From: Chris Malley <mail@chrismalley.co.uk>

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>

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);
 		}



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-26  5:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26  4:19 [PATCH] lguest example launcher truncates block device file to 0 length on problems Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox