Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Don't split executable paths with spaces in into multiple arguments
@ 2009-11-04 13:26 Jon Beniston
  2009-11-04 16:17 ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Beniston @ 2009-11-04 13:26 UTC (permalink / raw)
  To: gdb-patches

Hi,

The following patch prevents executable paths with spaces in them from being
passed to the simulator as multiple arguments.

OK to apply?

Cheers,
Jon

gdb/
2009-11-04  Jon Beniston  <jon@beniston.com>

	* remote-sim.c(gdbsim_create_inferior) Quote executable path in case
it
	contains spaces.

===================================================================
--- remote-sim.c        (revision 41)
+++ remote-sim.c        (working copy)
@@ -458,10 +458,13 @@

   if (exec_file != NULL)
     {
-      len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
+      len = 2 + strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
       arg_buf = (char *) alloca (len);
       arg_buf[0] = '\0';
+      /* Add quotes around exec_file in case there are spaces in the path.
*/
+      strcat (arg_buf, "\"");
       strcat (arg_buf, exec_file);
+      strcat (arg_buf, "\"");
       strcat (arg_buf, " ");
       strcat (arg_buf, args);
       argv = buildargv (arg_buf);




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-09 21:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-04 13:26 [PATCH] Don't split executable paths with spaces in into multiple arguments Jon Beniston
2009-11-04 16:17 ` Joel Brobecker
2009-11-09 17:42   ` Tom Tromey
2009-11-09 17:46     ` Joel Brobecker
2009-11-09 18:04       ` Tom Tromey
2009-11-09 21:11         ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox