From e60a752fce38bd2f9caafa2a50206d8bb38cb330 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Fri, 30 Jun 2006 01:55:55 -0700 Subject: [PATCH] --- yaml --- r: 31395 b: refs/heads/master c: 190f4939222b8c07cd62a20e1ce0c7a97fffde99 h: refs/heads/master i: 31393: 8fc43986169597831ef9c30a4169933b0c9463e3 31391: 47db3d3f0342cf8e8d595bb97e8dd3ed7ca95b25 v: v3 --- [refs] | 2 +- trunk/arch/um/os-Linux/mem.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 41363a66415f..b1d07ad16793 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c2b7a4bb30008dc256d63802e02b6fb950958443 +refs/heads/master: 190f4939222b8c07cd62a20e1ce0c7a97fffde99 diff --git a/trunk/arch/um/os-Linux/mem.c b/trunk/arch/um/os-Linux/mem.c index d24d1a960523..560c8063c77c 100644 --- a/trunk/arch/um/os-Linux/mem.c +++ b/trunk/arch/um/os-Linux/mem.c @@ -210,8 +210,11 @@ int create_tmp_file(unsigned long long len) exit(1); } - if (lseek64(fd, len, SEEK_SET) < 0) { - perror("os_seek_file"); + /* 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); }