summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2007-05-10 13:28:03 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2007-05-10 13:28:03 +0000
commitc0af72293dd61b6e1e29c830462d2303496ed765 (patch)
tree63be3063acb6c2cd38128d8d81dd895f45796f18 /gdb/cli
parent108c7f4249f1a92eb5df96f17043fbd81acc4e21 (diff)
downloadgdb-c0af72293dd61b6e1e29c830462d2303496ed765.tar.gz
* cli/cli-setshow.c (do_setshow_command): Remove trailing
whitespace when setting a var_filename.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-setshow.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 8baa47bfec3..91df9d01a0c 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -192,6 +192,13 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
error_no_arg (_("filename to set it to."));
if (*(char **) c->var != NULL)
xfree (*(char **) c->var);
+ {
+ /* Clear trailing whitespace of filename. */
+ char *ptr = arg + strlen (arg) - 1;
+ while (ptr >= arg && (*ptr == ' ' || *ptr == '\t'))
+ ptr--;
+ *(ptr + 1) = '\0';
+ }
*(char **) c->var = tilde_expand (arg);
break;
case var_boolean: