From 7c4f9f61a2c98b3ae2cd5f898738368e1836fab2 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 27 Jan 2012 19:03:37 +0000 Subject: xenpaging: make file_op largefile aware lseek() takes an off_t, the used "int << shiftsize" does not automatically convert the int into a larger type. This leads to write errors with pagefiles larger than 2G. Fix this by shifting an off_t instead of an int. Signed-off-by: Olaf Hering Committed-by: Ian Jackson --- tools/xenpaging/file_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools/xenpaging') diff --git a/tools/xenpaging/file_ops.c b/tools/xenpaging/file_ops.c index 079d2551a8..9351e168bd 100644 --- a/tools/xenpaging/file_ops.c +++ b/tools/xenpaging/file_ops.c @@ -26,12 +26,12 @@ static int file_op(int fd, void *page, int i, ssize_t (*fn)(int, void *, size_t)) { - off_t seek_ret; + off_t offset = i; int total = 0; int bytes; - seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET); - if ( seek_ret == (off_t)-1 ) + offset = lseek(fd, offset << PAGE_SHIFT, SEEK_SET); + if ( offset == (off_t)-1 ) return -1; while ( total < PAGE_SIZE ) -- cgit v1.2.3