From 42d02834892c7c7ac165d46c08d55ecfe9e8b643 Mon Sep 17 00:00:00 2001 From: axel Date: Mon, 8 Jan 2007 00:06:46 +1000 Subject: [PATCH] Fix bug in IO redirection making is possible for the IO redirections to fail in cases where there are multiple pipes and buffers using file descriptors above 2. darcs-hash:20070107140646-ac50b-dee4f380320ef2743635e77401a789c28d45f805.gz --- exec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index e4511394f..2388d9655 100644 --- a/exec.c +++ b/exec.c @@ -203,7 +203,7 @@ void free_fd( io_data_t *io, int fd ) if( !io ) return; - if( io->io_mode == IO_PIPE ) + if( ( io->io_mode == IO_PIPE ) || ( io->io_mode == IO_BUFFER ) ) { int i; for( i=0; i<2; i++ ) @@ -214,7 +214,7 @@ void free_fd( io_data_t *io, int fd ) { if( (io->param1.pipe_fd[i] = dup(fd)) == -1) { - if( errno != EINTR ) + if( errno != EINTR ) { debug( 1, FD_ERROR, @@ -224,11 +224,14 @@ void free_fd( io_data_t *io, int fd ) } } else + { break; + } } } } } + free_fd( io->next, fd ); } /**