aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@is.elta.co.il>2000-08-21 19:28:18 +0300
committerBruce Korb <korbb@gcc.gnu.org>2000-08-21 16:28:18 +0000
commitdc13bad72b60849788b55675d3ded5674b7dbdc8 (patch)
treebbe3ebb1a31e2a19d43171faf0e762b47cad7544
parentddd32db02d42cff54b0c92dd0722d7193cc8cb8b (diff)
downloadgcc-dc13bad72b60849788b55675d3ded5674b7dbdc8.zip
gcc-dc13bad72b60849788b55675d3ded5674b7dbdc8.tar.gz
gcc-dc13bad72b60849788b55675d3ded5674b7dbdc8.tar.bz2
prevent the deletion of a file before it is read on DOS
From-SVN: r35848
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/fixinc/fixincl.c11
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ef11439..a9f64a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2000-08-05 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * fixinc/fixincl.c (fix_with_system): Pipe the output of
+ "external" fixes through `cat', to avoid truncating the input
+ file by redirection.
+
2000-08-21 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.md (lea_general_1): Copy insn condition to split
diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c
index 3b13d70..9736537 100644
--- a/gcc/fixinc/fixincl.c
+++ b/gcc/fixinc/fixincl.c
@@ -914,10 +914,13 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file)
/* Don't use the "src > dstX; rm -f dst; mv -f dstX dst" trick:
dst is a temporary file anyway, so we know there's no other
file by that name; and DOS's system(3) doesn't mind to
- clobber existing file in redirection. Besides, with DOS 8+3
- limited file namespace, we can easily lose if dst already has
- an extension that is 3 or more characters long. */
- tSCC z_cmd_fmt[] = " %s > %s";
+ clobber existing file in redirection. Besides, with DOS 8+3
+ limited file namespace, we can easily lose if dst already has
+ an extension that is 3 or more characters long.
+ The following bizarre use of 'cat' only works on DOS boxes.
+ It is causing the file to be dropped into a temporary file for
+ 'cat' to read (pipes do not work on DOS). */
+ tSCC z_cmd_fmt[] = " %s | cat > %s";
tCC** ppArgs = p_fixd->patch_args;
argsize = sizeof( z_cmd_fmt ) + strlen( pz_temp_file )