1
1

* dir.c (do_load_dir): Remove dotdot_found - handle_dirent()

doesn't process ".." now.  Don't add ".." to the "/" directory.
(do_reload_dir): Likewise.
Suggested by Bulia Byak <bulia@dr.com>
Этот коммит содержится в:
Pavel Roskin 2003-01-19 12:37:27 +00:00
родитель abad291b5e
Коммит 02794a5cce
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -1,5 +1,10 @@
2003-01-19 Pavel Roskin <proski@gnu.org> 2003-01-19 Pavel Roskin <proski@gnu.org>
* dir.c (do_load_dir): Remove dotdot_found - handle_dirent()
doesn't process ".." now. Don't add ".." to the "/" directory.
(do_reload_dir): Likewise.
Suggested by Bulia Byak <bulia@dr.com>
* dir.c (handle_dirent): If mc_lstat() fails, assume that the * dir.c (handle_dirent): If mc_lstat() fails, assume that the
entry is a directory. This is useful for QNX Neutrino. entry is a directory. This is useful for QNX Neutrino.

Просмотреть файл

@ -471,7 +471,6 @@ do_load_dir (dir_list *list, sortfn *sort, int reverse, int case_sensitive,
int status, link_to_dir, stale_link; int status, link_to_dir, stale_link;
int next_free = 0; int next_free = 0;
struct stat buf; struct stat buf;
int dotdot_found = 0;
tree_store_start_check_cwd (); tree_store_start_check_cwd ();
@ -499,15 +498,14 @@ do_load_dir (dir_list *list, sortfn *sort, int reverse, int case_sensitive,
list->list[next_free].f.stale_link = stale_link; list->list[next_free].f.stale_link = stale_link;
list->list[next_free].f.dir_size_computed = 0; list->list[next_free].f.dir_size_computed = 0;
list->list[next_free].buf = buf; list->list[next_free].buf = buf;
if (strcmp (dp->d_name, "..") == 0)
dotdot_found = 1;
next_free++; next_free++;
if (!(next_free % 32)) if (!(next_free % 32))
rotate_dash (); rotate_dash ();
} }
if (next_free) { if (next_free) {
if (!dotdot_found) /* Add ".." except the root directory */
if (strcmp (vfs_canon ("."), "/") != 0)
add_dotdot_to_list (list, next_free++); add_dotdot_to_list (list, next_free++);
do_sort (list, sort, next_free - 1, reverse, case_sensitive); do_sort (list, sort, next_free - 1, reverse, case_sensitive);
} else { } else {
@ -578,7 +576,6 @@ do_reload_dir (dir_list * list, sortfn * sort, int count, int rev,
int next_free = 0; int next_free = 0;
int i, status, link_to_dir, stale_link; int i, status, link_to_dir, stale_link;
struct stat buf; struct stat buf;
int dotdot_found = 0;
int marked_cnt; int marked_cnt;
GHashTable *marked_files = g_hash_table_new (g_str_hash, g_str_equal); GHashTable *marked_files = g_hash_table_new (g_str_hash, g_str_equal);
@ -651,8 +648,6 @@ do_reload_dir (dir_list * list, sortfn * sort, int count, int rev,
list->list[next_free].f.stale_link = stale_link; list->list[next_free].f.stale_link = stale_link;
list->list[next_free].f.dir_size_computed = 0; list->list[next_free].f.dir_size_computed = 0;
list->list[next_free].buf = buf; list->list[next_free].buf = buf;
if (strcmp (dp->d_name, "..") == 0)
dotdot_found = 1;
next_free++; next_free++;
if (!(next_free % 16)) if (!(next_free % 16))
rotate_dash (); rotate_dash ();
@ -661,7 +656,8 @@ do_reload_dir (dir_list * list, sortfn * sort, int count, int rev,
tree_store_end_check (); tree_store_end_check ();
g_hash_table_destroy (marked_files); g_hash_table_destroy (marked_files);
if (next_free) { if (next_free) {
if (!dotdot_found) /* Add ".." except the root directory */
if (strcmp (vfs_canon ("."), "/") != 0)
add_dotdot_to_list (list, next_free++); add_dotdot_to_list (list, next_free++);
do_sort (list, sort, next_free - 1, rev, case_sensitive); do_sort (list, sort, next_free - 1, rev, case_sensitive);
} else } else