Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 190f4939 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

[PATCH] uml: fix off-by-one bug in VM file creation



Fix an off-by-one bug in temp file creation.  Seeking to the desired length
and writing a byte resulted in the file being one byte longer than expected.

Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c2b7a4bb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -210,7 +210,10 @@ int create_tmp_file(unsigned long long len)
		exit(1);
	}

        if (lseek64(fd, len, SEEK_SET) < 0) {
	/* Seek to len - 1 because writing a character there will
	 * increase the file size by one byte, to the desired length.
	 */
	if (lseek64(fd, len - 1, SEEK_SET) < 0) {
		perror("os_seek_file");
		exit(1);
	}