From 36771dcfa22b4954cba097946f66db0afdcf347e Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 9 Feb 2010 03:49:20 +0100 Subject: [PATCH] Ticket #2014: don't try to make directory NULL named in mkdir_cmd(). As input_expand_dialog() may return a pointer to an empty string, the function was trying to create a directory so named and thus print a false "File exists" error message. Signed-off-by: Francesco Cosoleto Signed-off-by: Andrew Borodin --- src/cmd.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 343677809..12fa92cbf 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -400,21 +400,22 @@ mkdir_cmd (void) if (!dir) return; - if (dir[0] == '/' || dir[0] == '~') - absdir = g_strdup (dir); - else - absdir = concat_dir_and_file (current_panel->cwd, dir); - - save_cwds_stat (); - if (my_mkdir (absdir, 0777) == 0) { - update_panels (UP_OPTIMIZE, dir); - repaint_screen (); - select_item (current_panel); - } else { - message (D_ERROR, MSG_ERROR, " %s ", unix_error_string (errno)); + if (*dir) { + if (dir[0] == '/' || dir[0] == '~') + absdir = g_strdup (dir); + else + absdir = concat_dir_and_file (current_panel->cwd, dir); + + save_cwds_stat (); + if (my_mkdir (absdir, 0777) == 0) { + update_panels (UP_OPTIMIZE, dir); + repaint_screen (); + select_item (current_panel); + } else { + message (D_ERROR, MSG_ERROR, " %s ", unix_error_string (errno)); + } + g_free (absdir); } - - g_free (absdir); g_free (dir); } -- 2.11.4.GIT