From e128fa1a8ef24441602b98cc87d52ac6bb87f4c5 Mon Sep 17 00:00:00 2001 From: axel Date: Sun, 25 Mar 2007 08:34:30 +1000 Subject: [PATCH] Fix a bug where io redirection of builtins would not truncate files if the builtin did not produce any output darcs-hash:20070324223430-ac50b-3f3d6fd35f5b82c59ecaa06b459fe2b61dc8f387.gz --- exec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/exec.c b/exec.c index 569332005..9b0e1cc6c 100644 --- a/exec.c +++ b/exec.c @@ -1316,6 +1316,8 @@ void exec( job_t *j ) ( !sb_out->used ) && ( !sb_err->used ) && ( !p->next ); + + int has_file_redirect = 0; /* If the output of a builtin is to be sent to an internal @@ -1337,6 +1339,14 @@ void exec( job_t *j ) free( res ); } + for( io = j->io; io; io=io->next ) + { + if( io->io_mode == IO_FILE ) + { + skip_fork = 0; + } + } + if( skip_fork ) { p->completed=1;