aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-10-01 17:35:30 +0000
committerMichael Snyder <msnyder@vmware.com>2010-10-01 17:35:30 +0000
commit55e3947383a45ec03e48390775fbf2699e640ec5 (patch)
treec2de8c8b68ea1512de10dc44b5ee6c81633b5ffd
parenta2c09bd0c7148be4ed1b9631905ebe891204be1a (diff)
downloadgdb-55e3947383a45ec03e48390775fbf2699e640ec5.zip
gdb-55e3947383a45ec03e48390775fbf2699e640ec5.tar.gz
gdb-55e3947383a45ec03e48390775fbf2699e640ec5.tar.bz2
2010-09-30 Ali Lakhia <lakhia@alumni.utexas.net>
* fork-child.c (breakup_args): Fix crash if shell forking is disabled at compile time.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/fork-child.c15
2 files changed, 13 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fafee4b..081b642 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-30 Ali Lakhia <lakhia@alumni.utexas.net>
+
+ * fork-child.c (breakup_args): Fix crash if shell forking is
+ disabled at compile time.
+
2010-10-01 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (desc_bounds): Add handling of the case where
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 7b81e8f..96885da 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -52,7 +52,7 @@ static char *exec_wrapper;
static void
breakup_args (char *scratch, char **argv)
{
- char *cp = scratch;
+ char *cp = scratch, *tmp;
for (;;)
{
@@ -68,15 +68,16 @@ breakup_args (char *scratch, char **argv)
*argv++ = cp;
/* Scan for next arg separator. */
- cp = strchr (cp, ' ');
- if (cp == NULL)
- cp = strchr (cp, '\t');
- if (cp == NULL)
- cp = strchr (cp, '\n');
+ tmp = strchr (cp, ' ');
+ if (tmp == NULL)
+ tmp = strchr (cp, '\t');
+ if (tmp == NULL)
+ tmp = strchr (cp, '\n');
/* No separators => end of string => break. */
- if (cp == NULL)
+ if (tmp == NULL)
break;
+ cp = tmp;
/* Replace the separator with a terminator. */
*cp++ = '\0';