part lseek
This commit is contained in:
parent
0695481526
commit
57bb5ae064
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -24,23 +24,25 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */
|
#if !__MESC__ && !__M2__
|
||||||
off_t
|
off_t
|
||||||
_lseek (int filedes, off_t offset, int whence)
|
_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
|
#endif
|
||||||
|
|
||||||
off_t
|
off_t
|
||||||
lseek (int filedes, off_t offset, int whence)
|
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)
|
if (_lseek (filedes, 0, SEEK_CUR) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
long long_offset = offset;
|
||||||
size_t skip = __buffered_read_clear (filedes);
|
size_t skip = __buffered_read_clear (filedes);
|
||||||
if (whence == SEEK_CUR)
|
if (whence == SEEK_CUR)
|
||||||
offset -= skip;
|
offset -= skip;
|
||||||
return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence);
|
return _sys_call3 (SYS_lseek, filedes, long_offset, whence);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue