>From 8fede4db2de4fd41ddf7e57b2d2c0e23f5deef67 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Dec 2020 02:16:18 +0100 Subject: [PATCH 2/3] unistd-safer: Implement pipe_safer on native Windows. * lib/pipe-safer.c (pipe_safer): Don't test HAVE_PIPE. * modules/unistd-safer (Depends-on): Add pipe-posix. --- ChangeLog | 6 ++++++ lib/pipe-safer.c | 8 ++------ modules/unistd-safer | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index afc5829..3d8478a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-12-24 Bruno Haible + unistd-safer: Implement pipe_safer on native Windows. + * lib/pipe-safer.c (pipe_safer): Don't test HAVE_PIPE. + * modules/unistd-safer (Depends-on): Add pipe-posix. + +2020-12-24 Bruno Haible + execute: Use posix_spawn by default on native Windows. * lib/execute.c (EXECUTE_IMPL_AVOID_POSIX_SPAWN): New macro. (execute): Use it to decide among the two possible implementations. diff --git a/lib/pipe-safer.c b/lib/pipe-safer.c index 5a597c5..a90ed81 100644 --- a/lib/pipe-safer.c +++ b/lib/pipe-safer.c @@ -30,7 +30,6 @@ int pipe_safer (int fd[2]) { -#if HAVE_PIPE if (pipe (fd) == 0) { int i; @@ -39,18 +38,15 @@ pipe_safer (int fd[2]) fd[i] = fd_safer (fd[i]); if (fd[i] < 0) { - int e = errno; + int saved_errno = errno; close (fd[1 - i]); - errno = e; + errno = saved_errno; return -1; } } return 0; } -#else - errno = ENOSYS; -#endif return -1; } diff --git a/modules/unistd-safer b/modules/unistd-safer index 2d195ec..d131b9c 100644 --- a/modules/unistd-safer +++ b/modules/unistd-safer @@ -12,6 +12,7 @@ m4/unistd-safer.m4 Depends-on: fcntl unistd +pipe-posix configure.ac: gl_UNISTD_SAFER -- 2.7.4