]> git.ipfire.org Git - thirdparty/glibc.git/blame - libio/oldiofgetpos64.c
(_IO_wfile_seekoff): Don't modify _offset and _wide_data->_IO_read_end if adjustment...
[thirdparty/glibc.git] / libio / oldiofgetpos64.c
CommitLineData
77fe0b9c 1/* Copyright (C) 1993,95,96,97,98,99,2000, 2002 Free Software Foundation, Inc.
41bdb6e2 2 This file is part of the GNU C Library.
d64b6ad0 3
41bdb6e2
AJ
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
d64b6ad0 8
41bdb6e2
AJ
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
d64b6ad0 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
d64b6ad0 13
41bdb6e2
AJ
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA.
d64b6ad0 18
41bdb6e2
AJ
19 As a special exception, if you link the code in this file with
20 files compiled with a GNU compiler to produce an executable,
21 that does not cause the resulting executable to be covered by
22 the GNU Lesser General Public License. This exception does not
23 however invalidate any other reasons why the executable file
24 might be covered by the GNU Lesser General Public License.
25 This exception applies to code released by its copyright holders
26 in files containing the exception. */
d64b6ad0
UD
27
28#include "libioP.h"
29#include <errno.h>
30
16710d58 31#include <shlib-compat.h>
a82f3aff 32#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_2)
16710d58 33
d64b6ad0
UD
34int
35_IO_old_fgetpos64 (fp, posp)
36 _IO_FILE *fp;
37 _IO_fpos64_t *posp;
38{
39#ifdef _G_LSEEK64
40 _IO_off64_t pos;
41 CHECK_FILE (fp, EOF);
42 _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
43 _IO_flockfile (fp);
77fe0b9c 44 pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
d64b6ad0
UD
45 if (_IO_in_backup (fp))
46 pos -= fp->_IO_save_end - fp->_IO_save_base;
47 _IO_funlockfile (fp);
48 _IO_cleanup_region_end (0);
49 if (pos == _IO_pos_BAD)
50 {
51 /* ANSI explicitly requires setting errno to a positive value on
52 failure. */
53#ifdef EIO
54 if (errno == 0)
55 __set_errno (EIO);
56#endif
57 return EOF;
58 }
59 posp->__pos = pos;
60 return 0;
61#else
62 __set_errno (ENOSYS);
63 return EOF;
64#endif
65}
66
67#ifdef weak_alias
d3d726ab 68compat_symbol (libc, _IO_old_fgetpos64, _IO_fgetpos64, GLIBC_2_1);
d64b6ad0 69strong_alias (_IO_old_fgetpos64, __old_fgetpos64)
d3d726ab 70compat_symbol (libc, __old_fgetpos64, fgetpos64, GLIBC_2_1);
16710d58
RM
71#endif
72
d64b6ad0 73#endif