From: Taylor R. Campbell Date: Tue, 10 Mar 2009 05:13:24 +0000 (+0000) Subject: Check, or ignore by casting to void, the values returned by system X-Git-Tag: 20090517-FFI~55 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f1d9cb876e900a8612c55e79caa8a930cf0af541;p=mit-scheme.git Check, or ignore by casting to void, the values returned by system calls in OS_make_subprocess, and kill the child if they fail. To change the working directory, the parent really ought to open the directory to check for errors before calling fchdir(2) in the child, but this will do for now. --- diff --git a/v7/src/microcode/uxproc.c b/v7/src/microcode/uxproc.c index e580089b3..2cf474014 100644 --- a/v7/src/microcode/uxproc.c +++ b/v7/src/microcode/uxproc.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: uxproc.c,v 1.38 2008/03/09 20:24:33 cph Exp $ +$Id: uxproc.c,v 1.39 2009/03/10 05:13:24 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -318,8 +318,8 @@ OS_make_subprocess (const char * filename, /* Don't do `transaction_commit ()' here. Because we used `vfork' to spawn the child, the side-effects that are performed by `transaction_commit' will occur in the parent as well. */ - if (working_directory != 0) - UX_chdir (working_directory); + if ((working_directory != 0) && ((UX_chdir (working_directory)) < 0)) + goto kill_child; { int in_fd = (-1); int out_fd = (-1); @@ -414,14 +414,14 @@ OS_make_subprocess (const char * filename, : (fd == STDERR_FILENO) ? (channel_err_type == process_channel_type_none) : 1) - UX_close (fd); + (void) UX_close (fd); } /* Put the signal mask and handlers in a normal state. */ UX_initialize_child_signals (); /* Start the process. */ - execve (filename, ((char * const *) argv), ((char * const *) envp)); + (void) execve (filename, ((char * const *) argv), ((char * const *) envp)); kill_child: _exit (1); }