Blame lib/msvc-nothrow.h

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