Fix build failures on EMX for output-sync support.

This commit is contained in:
Paul Smith 2013-09-29 13:17:56 -04:00
parent 3bf3fde984
commit 38066b6f19
5 changed files with 17 additions and 12 deletions

View File

@ -1,5 +1,10 @@
2013-09-29 Paul Smith <psmith@gnu.org>
* function.c (func_shell_base) [EMX]: Fix EMX support for output-sync.
* job.c (child_execute_job) [EMX]: Ditto.
* job.h (child_execute_job) [EMX]: Ditto.
* w32/compat/posixfcn.c: Invert the test for NO_OUTPUT_SYNC.
* guile.c (GSUBR_TYPE): Pre-2.0 Guile doesn't provide a typedef
for gsubr pointers. Create one.
(guile_define_module): Use it.

View File

@ -1652,15 +1652,15 @@ func_shell_base (char *o, char **argv, int trim_newlines)
#endif
/* Using a target environment for 'shell' loses in cases like:
export var = $(shell echo foobie)
because target_environment hits a loop trying to expand $(var)
to put it in the environment. This is even more confusing when
var was not explicitly exported, but just appeared in the
calling environment.
export var = $(shell echo foobie)
bad := $(var)
because target_environment hits a loop trying to expand $(var) to put it
in the environment. This is even more confusing when var was not
explicitly exported, but just appeared in the calling environment.
See Savannah bug #10593.
envp = target_environment (NILF);
envp = target_environment (NULL);
*/
envp = environ;
@ -1710,7 +1710,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
CLOSE_ON_EXEC(pipedes[1]);
CLOSE_ON_EXEC(pipedes[0]);
/* Never use fork()/exec() here! Use spawn() instead in exec_command() */
pid = child_execute_job (FD_STDIN, pipedes[1], FD_STDOUT, command_argv, envp);
pid = child_execute_job (FD_STDIN, pipedes[1], FD_STDERR, command_argv, envp);
if (pid < 0)
perror_with_name (error_prefix, "spawn");
# else /* ! __EMX__ */

6
job.c
View File

@ -2234,7 +2234,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
/* Restore stdout/stdin/stderr of the parent and close temporary FDs. */
if (save_stdin >= 0)
{
if (dup2 (save_stdin, FD_STDIN) != 0)
if (dup2 (save_stdin, FD_STDIN) != FD_STDIN)
fatal (NILF, _("Could not restore stdin\n"));
else
close (save_stdin);
@ -2242,7 +2242,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stdout >= 0)
{
if (dup2 (save_stdout, FD_STDOUT) != 0)
if (dup2 (save_stdout, FD_STDOUT) != FD_STDOUT)
fatal (NILF, _("Could not restore stdout\n"));
else
close (save_stdout);
@ -2250,7 +2250,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stderr >= 0)
{
if (dup2 (save_stderr, FD_STDERR) != 0)
if (dup2 (save_stderr, FD_STDERR) != FD_STDERR)
fatal (NILF, _("Could not restore stderr\n"));
else
close (save_stderr);

2
job.h
View File

@ -128,7 +128,7 @@ int child_execute_job (char *argv, struct child *child);
# define FD_STDERR (fileno (stderr))
# if defined(__EMX__)
int child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
char **argv, char **envp)
char **argv, char **envp);
# else
void child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
char **argv, char **envp) __attribute__ ((noreturn));

View File

@ -26,7 +26,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "job.h"
#ifdef NO_OUTPUT_SYNC
#ifndef NO_OUTPUT_SYNC
/* Support for OUTPUT_SYNC and related functionality. */
/* Emulation of fcntl that supports only F_GETFD and F_SETLKW. */