[ros-diffs] [turner] 18250: dont use the whole commandline as a fall back for execution searching because it could contain spaces. also, wrap commandline params in quotes so if there is a space in the path it still finds it. bug found by billgMS.

turner at svn.reactos.com turner at svn.reactos.com
Mon Oct 3 22:28:33 CEST 2005


dont use the whole commandline as a fall back for execution searching
because it could contain spaces.  also, wrap commandline params in
quotes so if there is a space in the path it still finds it.  bug found
by billgMS.
Modified: trunk/reactos/subsys/system/cmd/cmd.c
  _____  

Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c	2005-10-03 18:49:44 UTC
(rev 18249)
+++ trunk/reactos/subsys/system/cmd/cmd.c	2005-10-03 20:28:29 UTC
(rev 18250)
@@ -423,15 +423,12 @@

 	/* search the PATH environment variable for the binary */
 	if (!SearchForExecutable (first, szFullName))
 	{
-		if (!SearchForExecutable (full, szFullName))
-		{
 			error_bad_command ();
 			free (first);
 			free (rest);
 			free (full);
 			free (szFullName);
 			return;
-		}
 
 	}
 
@@ -1619,13 +1616,14 @@
 				++i;
 				if (i < argc)
 				{
-					_tcscpy (commandline, argv[i]);
+					_tcscpy (commandline, _T("\""));
+					_tcscat (commandline, argv[i]);
+					_tcscat (commandline, _T("\""));
 					while (++i < argc)
 					{
 						_tcscat (commandline,
_T(" "));
 						_tcscat (commandline,
argv[i]);
 					}
-
 					ParseCommandLine(commandline);
 				}
 			}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051003/b521abd0/attachment.html


More information about the Ros-diffs mailing list