X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gnu%2Fclose.c;h=54d1f71b9c370b18af1d2858856d16d7ab0abe89;hb=HEAD;hp=b8bdcfa780b67b9478e86e9b6c0df35c6ca43fff;hpb=bc973a082dddfe8c66baf7352df0433f83479ce1;p=debian%2Ftar diff --git a/gnu/close.c b/gnu/close.c index b8bdcfa7..54d1f71b 100644 --- a/gnu/close.c +++ b/gnu/close.c @@ -1,7 +1,5 @@ -/* -*- buffer-read-only: t -*- vi: set ro: */ -/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* close replacement. - Copyright (C) 2008-2011 Free Software Foundation, Inc. + Copyright (C) 2008-2015 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 @@ -21,18 +19,45 @@ /* Specification. */ #include -#include "close-hook.h" +#include + +#include "fd-hook.h" +#include "msvc-inval.h" + +#undef close + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static int +close_nothrow (int fd) +{ + int result; + + TRY_MSVC_INVAL + { + result = close (fd); + } + CATCH_MSVC_INVAL + { + result = -1; + errno = EBADF; + } + DONE_MSVC_INVAL; + + return result; +} +#else +# define close_nothrow close +#endif /* Override close() to call into other gnulib modules. */ int rpl_close (int fd) -#undef close { #if WINDOWS_SOCKETS - int retval = execute_all_close_hooks (fd); + int retval = execute_all_close_hooks (close_nothrow, fd); #else - int retval = close (fd); + int retval = close_nothrow (fd); #endif #if REPLACE_FCHDIR