* infcmd.c (construct_inferior_arguments): Handle empty arguments.
This commit is contained in:
parent
6297c1fede
commit
03c6228e78
2 changed files with 18 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
|||
2002-12-03 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* infcmd.c (construct_inferior_arguments): Handle empty arguments.
|
||||
|
||||
2002-12-02 Adam Fedor <fedor@gnu.org>
|
||||
Klee Dienes <kdienes@apple.com>
|
||||
|
||||
|
|
19
gdb/infcmd.c
19
gdb/infcmd.c
|
@ -278,7 +278,7 @@ construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv)
|
|||
|
||||
/* We over-compute the size. It shouldn't matter. */
|
||||
for (i = 0; i < argc; ++i)
|
||||
length += 2 * strlen (argv[i]) + 1;
|
||||
length += 2 * strlen (argv[i]) + 1 + 2 * (argv[i][0] == '\0');
|
||||
|
||||
result = (char *) xmalloc (length);
|
||||
out = result;
|
||||
|
@ -288,11 +288,20 @@ construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv)
|
|||
if (i > 0)
|
||||
*out++ = ' ';
|
||||
|
||||
for (cp = argv[i]; *cp; ++cp)
|
||||
/* Need to handle empty arguments specially. */
|
||||
if (argv[i][0] == '\0')
|
||||
{
|
||||
if (strchr (special, *cp) != NULL)
|
||||
*out++ = '\\';
|
||||
*out++ = *cp;
|
||||
*out++ = '\'';
|
||||
*out++ = '\'';
|
||||
}
|
||||
else
|
||||
{
|
||||
for (cp = argv[i]; *cp; ++cp)
|
||||
{
|
||||
if (strchr (special, *cp) != NULL)
|
||||
*out++ = '\\';
|
||||
*out++ = *cp;
|
||||
}
|
||||
}
|
||||
}
|
||||
*out = '\0';
|
||||
|
|
Loading…
Reference in a new issue