From 62bbe532056a0b2d0c075a8232f2c0721c863cac Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 10 Mar 2012 12:19:31 +0300 Subject: [PATCH] (edit_load_file_from_filename): fixed file unlocking. Signed-off-by: Andrew Borodin --- src/editor/editcmd.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index dd43f645f..8e6c9a973 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -492,24 +492,16 @@ edit_load_file_from_filename (WEdit * edit, const vfs_path_t * exp_vpath) { int prev_locked = edit->locked; vfs_path_t *prev_filename; + int ret = 0; prev_filename = vfs_path_clone (edit->filename_vpath); if (!edit_reload (edit, exp_vpath)) - { - vfs_path_free (prev_filename); - return 1; - } + ret = 1; + else if (prev_locked) + unlock_file (prev_filename); - if (prev_locked) - { - vfs_path_t *fullpath; - - fullpath = vfs_path_append_vpath_new (edit->dir_vpath, prev_filename, (char *) NULL); - unlock_file (fullpath); - vfs_path_free (fullpath); - } vfs_path_free (prev_filename); - return 0; + return ret; } /* --------------------------------------------------------------------------------------------- */