Blame lib/msvc-nothrow.h

Packit Service a2489d
/* Wrappers that don't throw invalid parameter notifications
Packit Service a2489d
   with MSVC runtime libraries.
Packit Service a2489d
   Copyright (C) 2011-2018 Free Software Foundation, Inc.
Packit Service a2489d
Packit Service a2489d
   This program is free software; you can redistribute it and/or modify
Packit Service a2489d
   it under the terms of the GNU General Public License as published by
Packit Service a2489d
   the Free Software Foundation; either version 3, or (at your option)
Packit Service a2489d
   any later version.
Packit Service a2489d
Packit Service a2489d
   This program is distributed in the hope that it will be useful,
Packit Service a2489d
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service a2489d
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service a2489d
   GNU General Public License for more details.
Packit Service a2489d
Packit Service a2489d
   You should have received a copy of the GNU General Public License along
Packit Service a2489d
   with this program; if not, see <https://www.gnu.org/licenses/>.  */
Packit Service a2489d
Packit Service a2489d
#ifndef _MSVC_NOTHROW_H
Packit Service a2489d
#define _MSVC_NOTHROW_H
Packit Service a2489d
Packit Service a2489d
/* With MSVC runtime libraries with the "invalid parameter handler" concept,
Packit Service a2489d
   functions like fprintf(), dup2(), or close() crash when the caller passes
Packit Service a2489d
   an invalid argument.  But POSIX wants error codes (such as EINVAL or EBADF)
Packit Service a2489d
   instead.
Packit Service a2489d
   This file defines wrappers that turn such an invalid parameter notification
Packit Service a2489d
   into an error code.  */
Packit Service a2489d
Packit Service a2489d
#if defined _WIN32 && ! defined __CYGWIN__
Packit Service a2489d
Packit Service a2489d
/* Get original declaration of _get_osfhandle.  */
Packit Service a2489d
# include <io.h>
Packit Service a2489d
Packit Service a2489d
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
Packit Service a2489d
Packit Service a2489d
/* Override _get_osfhandle.  */
Packit Service a2489d
extern intptr_t _gl_nothrow_get_osfhandle (int fd);
Packit Service a2489d
#  define _get_osfhandle _gl_nothrow_get_osfhandle
Packit Service a2489d
Packit Service a2489d
# endif
Packit Service a2489d
Packit Service a2489d
#endif
Packit Service a2489d
Packit Service a2489d
#endif /* _MSVC_NOTHROW_H */