mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge from gnulib
This incorporates: 2017-05-13 largefile: Simplify 2017-05-13 largefile: Improve and document 2017-05-13 truncate: New module 2017-05-13 windows-stat-timespec: New module 2017-05-13 windows-stat-override: New module 2017-05-11 getopt-posix: port to mingw 2017-05-11 gettimeofday: Increase precision on mingw 2017-05-10 time: Fix missing initialization of HAVE_TIMEZONE_T 2017-05-10 Implement a way to opt out from MSVC support 2017-05-09 tzset: Expand comment about TZ problem on native Windows * build-aux/config.guess, lib/dup2.c, lib/fcntl.c, lib/fsync.c: * lib/getdtablesize.c, lib/getopt.c, lib/gettimeofday.c: * lib/mktime.c, lib/stat-time.h, lib/sys_stat.in.h, lib/unistd.in.h: * lib/utimens.c, m4/gettimeofday.m4, m4/largefile.m4: * m4/sys_stat_h.m4, m4/sys_time_h.m4, m4/time_h.m4, m4/time_rz.m4: * m4/unistd_h.m4: Copy from gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
This commit is contained in:
parent
9a5e864de7
commit
4132bd74e9
21 changed files with 344 additions and 129 deletions
44
lib/dup2.c
44
lib/dup2.c
|
|
@ -35,10 +35,39 @@
|
|||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
# include "msvc-inval.h"
|
||||
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
# include "msvc-inval.h"
|
||||
# endif
|
||||
|
||||
/* Get _get_osfhandle. */
|
||||
# include "msvc-nothrow.h"
|
||||
# if GNULIB_MSVC_NOTHROW
|
||||
# include "msvc-nothrow.h"
|
||||
# else
|
||||
# include <io.h>
|
||||
# endif
|
||||
|
||||
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
static int
|
||||
dup2_nothrow (int fd, int desired_fd)
|
||||
{
|
||||
int result;
|
||||
|
||||
TRY_MSVC_INVAL
|
||||
{
|
||||
result = dup2 (fd, desired_fd);
|
||||
}
|
||||
CATCH_MSVC_INVAL
|
||||
{
|
||||
errno = EBADF;
|
||||
result = -1;
|
||||
}
|
||||
DONE_MSVC_INVAL;
|
||||
|
||||
return result;
|
||||
}
|
||||
# else
|
||||
# define dup2_nothrow dup2
|
||||
# endif
|
||||
|
||||
static int
|
||||
ms_windows_dup2 (int fd, int desired_fd)
|
||||
|
|
@ -66,16 +95,7 @@ ms_windows_dup2 (int fd, int desired_fd)
|
|||
return -1;
|
||||
}
|
||||
|
||||
TRY_MSVC_INVAL
|
||||
{
|
||||
result = dup2 (fd, desired_fd);
|
||||
}
|
||||
CATCH_MSVC_INVAL
|
||||
{
|
||||
errno = EBADF;
|
||||
result = -1;
|
||||
}
|
||||
DONE_MSVC_INVAL;
|
||||
result = dup2_nothrow (fd, desired_fd);
|
||||
|
||||
if (result == 0)
|
||||
result = desired_fd;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue