Mercurial > hg > octave-shane > gnulib-hg
view lib/msvc-inval.c @ 15727:144db791c6fa
Ensure EBADF returns for socket functions on mingw.
* lib/accept.c (rpl_accept): Fail with error EBADF if the file
descriptor is invalid.
* lib/bind.c (rpl_bind): Likewise.
* lib/connect.c (rpl_connect): Likewise.
* lib/getpeername.c (rpl_getpeername): Likewise.
* lib/getsockname.c (rpl_getsockname): Likewise.
* lib/getsockopt.c (rpl_getsockopt): Likewise.
* lib/listen.c (rpl_listen): Likewise.
* lib/recv.c (rpl_recv): Likewise.
* lib/recvfrom.c (rpl_recvfrom): Likewise.
* lib/send.c (rpl_send): Likewise.
* lib/sendto.c (rpl_sendto): Likewise.
* lib/setsockopt.c (rpl_setsockopt): Likewise.
* lib/shutdown.c (rpl_shutdown): Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 21 Sep 2011 00:20:59 +0200 |
parents | 6ef4d991e582 |
children | f1e8251b45f3 |
line wrap: on
line source
/* Invalid parameter handler for MSVC runtime libraries. Copyright (C) 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> /* Specification. */ #include "msvc-inval.h" #if HAVE_MSVC_INVALID_PARAMETER_HANDLER # ifdef STATUS_GNULIB_INVALID_PARAMETER /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> static void cdecl gl_msvc_invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t dummy) { RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); } static int gl_msvc_inval_initialized /* = 0 */; void gl_msvc_inval_ensure_handler (void) { if (gl_msvc_inval_initialized == 0) { _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler); gl_msvc_inval_initialized = 1; } } # else jmp_buf gl_msvc_inval_restart; void cdecl gl_msvc_invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t dummy) { longjmp (gl_msvc_inval_restart, 1); } # endif #endif