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
1 changed files with 7 additions and 3 deletions

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
(if any) must be the first in the list. */
tmp_path = vfs_path_get_by_index (vpath, 0)->path;
if (!
(vfs_path_elements_count (vpath) == 1 && (tmp_path[0] == PATH_SEP)
&& (tmp_path[1] == '\0')))
if (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))
{
@ -765,6 +768,7 @@ dir_list_reload (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort,
while ((dp = mc_readdir (dirp)) != NULL)
{
file_entry_t *fentry;
if (!handle_dirent (dp, fltr, &st, &link_to_dir, &stale_link))
continue;