aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-setshow.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli/cli-setshow.c')
-rw-r--r--gdb/cli/cli-setshow.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 4b01e62..fca92b0 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -180,15 +180,16 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
xfree (*(char **) c->var);
*(char **) c->var = savestring (arg, strlen (arg));
break;
- case var_filename:
case var_optional_filename:
if (arg == NULL)
- {
- if (c->var_type == var_optional_filename)
- arg = "";
- else
- error_no_arg (_("filename to set it to."));
- }
+ arg = "";
+ if (*(char **) c->var != NULL)
+ xfree (*(char **) c->var);
+ *(char **) c->var = savestring (arg, strlen (arg));
+ break;
+ case var_filename:
+ if (arg == NULL)
+ error_no_arg (_("filename to set it to."));
if (*(char **) c->var != NULL)
xfree (*(char **) c->var);
*(char **) c->var = tilde_expand (arg);