This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Properly quote temp file names for fixincludes



DOS style paths with backslashes used to get exposed to
shell without any quoting, so 'c:\djgpp\tmp' becomes 'c:djgpptmp'.
Naturally, this does not work.

OK for head/branch?

2001-03-15  Laurynas Biveinis  <lauras@softhome.net>

	* fixincl.c (fix_with_system): Quote file names before
	passing them to shell.

Index: gcc/gcc/fixinc/fixincl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/fixincl.c,v
retrieving revision 1.50.2.1
diff -u -p -r1.50.2.1 fixincl.c
--- fixincl.c	2001/03/02 19:52:01	1.50.2.1
+++ fixincl.c	2001/03/15 19:03:06
@@ -908,7 +908,7 @@ fix_with_system (p_fixd, pz_fix_file, pz
       /*
        *  Now add the fix number and file names that may be needed
        */
-      sprintf (pz_scan, "%ld %s %s %s", p_fixd - fixDescList,
+      sprintf (pz_scan, "%ld \"%s\" \"%s\" \"%s\"", p_fixd - fixDescList,
 	       pz_fix_file, pz_file_source, pz_temp_file);
     }
   else /* NOT an "internal" fix: */
@@ -927,7 +927,7 @@ fix_with_system (p_fixd, pz_fix_file, pz
          the following bizarre use of 'cat' only works on DOS boxes.
          It causes 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";
+      tSCC   z_cmd_fmt[] = " \"%s\" | cat > \"%s\"";
 #else
       /* Don't use positional formatting arguments because some lame-o
          implementations cannot cope  :-(.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]