X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffdopen.c;h=50c889b17a4a9732064e1a3f7587b9fc51fbe0f4;hb=d48d7d9132b633a3a31a2f6f131ce7033f1faf8d;hp=c443ab66020095ce2066f0091831eb2f7f96e632;hpb=5f12d9389f0d0597c4996dfb15c0a5c64808774a;p=gnulib.git diff --git a/lib/fdopen.c b/lib/fdopen.c index c443ab660..50c889b17 100644 --- a/lib/fdopen.c +++ b/lib/fdopen.c @@ -21,8 +21,34 @@ #include +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif + #undef fdopen +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static FILE * +fdopen_nothrow (int fd, const char *mode) +{ + FILE *result; + + TRY_MSVC_INVAL + { + result = fdopen (fd, mode); + } + CATCH_MSVC_INVAL + { + result = NULL; + } + DONE_MSVC_INVAL; + + return result; +} +#else +# define fdopen_nothrow fdopen +#endif + FILE * rpl_fdopen (int fd, const char *mode) { @@ -30,7 +56,7 @@ rpl_fdopen (int fd, const char *mode) FILE *fp; errno = 0; - fp = fdopen (fd, mode); + fp = fdopen_nothrow (fd, mode); if (fp == NULL) { if (errno == 0)