Fix reloading of the root directory.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2013-10-16 13:25:50 +04:00
parent b136b2fa9f
commit 673d438938

View File

@ -743,9 +743,12 @@ dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort,
/* Add ".." except to the root directory. The ".." entry /* Add ".." except to the root directory. The ".." entry
(if any) must be the first in the list. */ (if any) must be the first in the list. */
tmp_path = vfs_path_get_by_index (vpath, 0)->path; tmp_path = vfs_path_get_by_index (vpath, 0)->path;
if (! if (vfs_path_elements_count (vpath) == 1 && tmp_path[0] == PATH_SEP && tmp_path[1] == '\0')
(vfs_path_elements_count (vpath) == 1 && (tmp_path[0] == PATH_SEP) {
&& (tmp_path[1] == '\0'))) /* root directory */
dir_list_clean (list);
}
else
{ {
if (!dir_list_init (list)) if (!dir_list_init (list))
{ {
@ -765,6 +768,7 @@ dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort,
while ((dp = mc_readdir (dirp)) != NULL) while ((dp = mc_readdir (dirp)) != NULL)
{ {
file_entry_t *fentry; file_entry_t *fentry;
if (!handle_dirent (dp, fltr, &st, &link_to_dir, &stale_link)) if (!handle_dirent (dp, fltr, &st, &link_to_dir, &stale_link))
continue; continue;