+2020-11-30 Bruno Haible <bruno@clisp.org>
+
+ execute: Fix uninitialized use of errno.
+ * lib/execute.c (execute): Preserve errno across several system calls.
+
2020-11-30 Bruno Haible <bruno@clisp.org>
access tests: Fix test failure on native Windows.
/* Native Windows API. */
+ int saved_errno;
+
/* FIXME: Need to free memory allocated by prepare_spawn. */
prog_argv = prepare_spawn (prog_argv);
stdin_handle, stdout_handle, stderr_handle);
}
}
+ if (exitcode == -1)
+ saved_errno = errno;
if (nulloutfd >= 0)
close (nulloutfd);
if (nullinfd >= 0)
if (exitcode == -1)
{
if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
+ error (exit_on_error ? EXIT_FAILURE : 0, saved_errno,
_("%s subprocess failed"), progname);
return 127;
}