From a01943bb611a77eabd7ab7539f2d9458854087bd Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 5 Dec 2013 16:23:53 +0100 Subject: [PATCH] Fix Xaw file-browser New Directory Prevent people from using the error messages that will be printed here as directory name by pressing New Directory a second time after first pressing it with an empty or existing name. --- dialogs.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dialogs.c b/dialogs.c index 6bb83f1..ad164ce 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2487,13 +2487,17 @@ Refresh (int pathFlag) SetWidgetLabel(&browseOptions[0], title); } +static char msg1[] = N_("FIRST TYPE DIRECTORY NAME HERE"); +static char msg2[] = N_("TRY ANOTHER NAME"); + void CreateDir (int n) { char *name, *errmsg = ""; GetWidgetText(&browseOptions[n-1], &name); - if(!name[0]) errmsg = _("FIRST TYPE DIRECTORY NAME HERE"); else - if(mkdir(name, 0755)) errmsg = _("TRY ANOTHER NAME"); + if(!strcmp(name, msg1) || !strcmp(name, msg2)) return; + if(!name[0]) errmsg = _(msg1); else + if(mkdir(name, 0755)) errmsg = _(msg2); else { chdir(name); Refresh(-1); -- 1.7.0.4