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