|
Packit |
6c4009 |
/* Copyright (C) 1993-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
As a special exception, if you link the code in this file with
|
|
Packit |
6c4009 |
files compiled with a GNU compiler to produce an executable,
|
|
Packit |
6c4009 |
that does not cause the resulting executable to be covered by
|
|
Packit |
6c4009 |
the GNU Lesser General Public License. This exception does not
|
|
Packit |
6c4009 |
however invalidate any other reasons why the executable file
|
|
Packit |
6c4009 |
might be covered by the GNU Lesser General Public License.
|
|
Packit |
6c4009 |
This exception applies to code released by its copyright holders
|
|
Packit |
6c4009 |
in files containing the exception. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* We need to avoid the header declarations of these, because
|
|
Packit |
6c4009 |
the types don't match _IO_fsetpos and then the compiler will
|
|
Packit |
6c4009 |
complain about the mismatch when we do the alias below. */
|
|
Packit |
6c4009 |
#define _IO_new_fsetpos64 __renamed__IO_new_fsetpos64
|
|
Packit |
6c4009 |
#define _IO_fsetpos64 __renamed__IO_fsetpos64
|
|
Packit |
6c4009 |
#define fsetpos64 __renamed_fsetpos64
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <libioP.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef _IO_new_fsetpos64
|
|
Packit |
6c4009 |
#undef _IO_fsetpos64
|
|
Packit |
6c4009 |
#undef fsetpos64
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <errno.h>
|
|
Packit |
6c4009 |
#include <shlib-compat.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
int
|
|
Packit |
6c4009 |
_IO_new_fsetpos (FILE *fp, const __fpos_t *posp)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int result;
|
|
Packit |
6c4009 |
CHECK_FILE (fp, EOF);
|
|
Packit |
6c4009 |
_IO_acquire_lock (fp);
|
|
Packit |
6c4009 |
if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
|
|
Packit |
6c4009 |
== _IO_pos_BAD)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* ANSI explicitly requires setting errno to a positive value on
|
|
Packit |
6c4009 |
failure. */
|
|
Packit |
6c4009 |
if (errno == 0)
|
|
Packit |
6c4009 |
__set_errno (EIO);
|
|
Packit |
6c4009 |
result = EOF;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
else
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
result = 0;
|
|
Packit Service |
357fe4 |
if (fp->_mode > 0 && __libio_codecvt_encoding (fp->_codecvt) < 0)
|
|
Packit |
6c4009 |
/* This is a stateful encoding, restore the state. */
|
|
Packit |
6c4009 |
fp->_wide_data->_IO_state = posp->__state;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
_IO_release_lock (fp);
|
|
Packit |
6c4009 |
return result;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
strong_alias (_IO_new_fsetpos, __new_fsetpos)
|
|
Packit |
6c4009 |
versioned_symbol (libc, _IO_new_fsetpos, _IO_fsetpos, GLIBC_2_2);
|
|
Packit |
6c4009 |
versioned_symbol (libc, __new_fsetpos, fsetpos, GLIBC_2_2);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __OFF_T_MATCHES_OFF64_T
|
|
Packit |
6c4009 |
strong_alias (_IO_new_fsetpos, _IO_new_fsetpos64)
|
|
Packit |
6c4009 |
strong_alias (_IO_new_fsetpos64, __new_fsetpos64)
|
|
Packit |
6c4009 |
versioned_symbol (libc, __new_fsetpos64, fsetpos64, GLIBC_2_2);
|
|
Packit |
6c4009 |
versioned_symbol (libc, _IO_new_fsetpos64, _IO_fsetpos64, GLIBC_2_2);
|
|
Packit |
6c4009 |
#endif
|