|
@@ -535,20 +535,22 @@ do_load_dir (const char *path, dir_list * list, sortfn * sort, gboolean lc_rever
|
|
|
int status, link_to_dir, stale_link;
|
|
|
int next_free = 0;
|
|
|
struct stat st;
|
|
|
+ vfs_path_t *vpath;
|
|
|
|
|
|
/* ".." (if any) must be the first entry in the list */
|
|
|
if (!set_zero_dir (list))
|
|
|
return next_free;
|
|
|
|
|
|
+ vpath = vfs_path_from_str (path);
|
|
|
if (get_dotdot_dir_stat (path, &st))
|
|
|
list->list[next_free].st = st;
|
|
|
next_free++;
|
|
|
|
|
|
- dirp = mc_opendir (path);
|
|
|
- if (!dirp)
|
|
|
+ dirp = mc_opendir (vpath);
|
|
|
+ if (dirp == NULL)
|
|
|
{
|
|
|
message (D_ERROR, MSG_ERROR, _("Cannot read directory contents"));
|
|
|
- return next_free;
|
|
|
+ goto ret;
|
|
|
}
|
|
|
|
|
|
tree_store_start_check (path);
|
|
@@ -566,7 +568,7 @@ do_load_dir (const char *path, dir_list * list, sortfn * sort, gboolean lc_rever
|
|
|
{
|
|
|
tree_store_end_check ();
|
|
|
mc_closedir (dirp);
|
|
|
- return next_free;
|
|
|
+ goto ret;
|
|
|
}
|
|
|
list->list[next_free].fnamelen = NLENGTH (dp);
|
|
|
list->list[next_free].fname = g_strndup (dp->d_name, list->list[next_free].fnamelen);
|
|
@@ -588,6 +590,8 @@ do_load_dir (const char *path, dir_list * list, sortfn * sort, gboolean lc_rever
|
|
|
|
|
|
mc_closedir (dirp);
|
|
|
tree_store_end_check ();
|
|
|
+ ret:
|
|
|
+ vfs_path_free (vpath);
|
|
|
return next_free;
|
|
|
}
|
|
|
|
|
@@ -623,12 +627,15 @@ do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
|
|
|
struct stat st;
|
|
|
int marked_cnt;
|
|
|
GHashTable *marked_files;
|
|
|
+ vfs_path_t *vpath;
|
|
|
|
|
|
- dirp = mc_opendir (path);
|
|
|
- if (!dirp)
|
|
|
+ vpath = vfs_path_from_str (path);
|
|
|
+ dirp = mc_opendir (vpath);
|
|
|
+ if (dirp == NULL)
|
|
|
{
|
|
|
message (D_ERROR, MSG_ERROR, _("Cannot read directory contents"));
|
|
|
clean_dir (list, count);
|
|
|
+ vfs_path_free (vpath);
|
|
|
return set_zero_dir (list) ? 1 : 0;
|
|
|
}
|
|
|
|
|
@@ -660,7 +667,7 @@ do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
|
|
|
{
|
|
|
clean_dir (list, count);
|
|
|
clean_dir (&dir_copy, count);
|
|
|
- return next_free;
|
|
|
+ goto ret;
|
|
|
}
|
|
|
|
|
|
if (get_dotdot_dir_stat (path, &st))
|
|
@@ -689,7 +696,7 @@ do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
|
|
|
*/
|
|
|
tree_store_end_check ();
|
|
|
g_hash_table_destroy (marked_files);
|
|
|
- return next_free;
|
|
|
+ goto ret;
|
|
|
}
|
|
|
|
|
|
list->list[next_free].f.marked = 0;
|
|
@@ -728,6 +735,8 @@ do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
|
|
|
do_sort (list, sort, next_free - 1, lc_reverse, lc_case_sensitive, exec_ff);
|
|
|
}
|
|
|
clean_dir (&dir_copy, count);
|
|
|
+ ret:
|
|
|
+ vfs_path_free (vpath);
|
|
|
return next_free;
|
|
|
}
|
|
|
|