aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2007-03-25 08:34:30 +1000
committerGravatar axel <axel@liljencrantz.se>2007-03-25 08:34:30 +1000
commite128fa1a8ef24441602b98cc87d52ac6bb87f4c5 (patch)
tree8947fed7a1d64f798dd65d0fb8e0dbdc6f226886 /exec.c
parente8ba091161277b397221c782b729f8d97b187de7 (diff)
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
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 56933200..9b0e1cc6 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;