From 57bb5ae06448e50426aa9dd21114b2ba8b33385d Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Wed, 19 Oct 2022 09:04:58 +0200 Subject: [PATCH] part lseek --- lib/linux/lseek.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/linux/lseek.c b/lib/linux/lseek.c index f71af59f..b8ebffc5 100644 --- a/lib/linux/lseek.c +++ b/lib/linux/lseek.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,23 +24,25 @@ #include #include -#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */ +#if !__MESC__ && !__M2__ off_t _lseek (int filedes, off_t offset, int whence) { - return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence); + long long_offset = offset; + return _sys_call3 (SYS_lseek, filedes, long_offset, whence); } #endif off_t lseek (int filedes, off_t offset, int whence) { -#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */ +#if !__MESC__ && !__M2__ if (_lseek (filedes, 0, SEEK_CUR) == -1) return -1; #endif + long long_offset = offset; size_t skip = __buffered_read_clear (filedes); if (whence == SEEK_CUR) offset -= skip; - return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence); + return _sys_call3 (SYS_lseek, filedes, long_offset, whence); }