* dir.c (handle_dirent): Fix cleaning the stat buffer if

mc_lstat() fails.  Leave buf1->st_mode to be 0, so that the
entry is marked as a "non-regular file of unknown kind".
* screen.c (do_enter_on_file_entry): Try to change directory
when pressing Enter on a non-stat()able file.
This commit is contained in:
Pavel Roskin 2003-01-21 00:31:43 +00:00
parent 7532ed2827
commit 2665057b7c
3 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,11 @@
2003-01-20 Pavel Roskin <proski@gnu.org>
* dir.c (handle_dirent): Fix cleaning the stat buffer if
mc_lstat() fails. Leave buf1->st_mode to be 0, so that the
entry is marked as a "non-regular file of unknown kind".
* screen.c (do_enter_on_file_entry): Try to change directory
when pressing Enter on a non-stat()able file.
* screen.c (string_file_size_brief): Represent non-regular files
of unknown kind by '?'.
(file_compute_color): Use for them the same color as for stale

View File

@ -383,12 +383,11 @@ handle_dirent (dir_list *list, char *filter, struct dirent *dp,
return 0;
if (mc_lstat (dp->d_name, buf1) == -1) {
/*
* lstat() fails - wildly assume that it's a directory.
* It can happen on QNX Neutrino for /fs/cd0 if no CD is inserted.
* lstat() fails - such entries should be identified by
* buf1->st_mode being 0.
* It happens on QNX Neutrino for /fs/cd0 if no CD is inserted.
*/
memset (buf1, 0, sizeof (buf1));
buf1->st_mode = S_IFDIR | 0777;
buf1->st_nlink = 2;
memset (buf1, 0, sizeof (*buf1));
}
if (S_ISDIR (buf1->st_mode))

View File

@ -1929,8 +1929,12 @@ do_enter_on_file_entry (file_entry *fe)
{
char *full_name;
/* Directory or link to directory - change directory */
if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)) {
/*
* Directory or link to directory - change directory.
* Try the same for the entries on which mc_lstat() has failed.
*/
if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)
|| (fe->buf.st_mode == 0)) {
if (!do_cd (fe->fname, cd_exact))
message (1, MSG_ERROR, _("Cannot change directory"));
return 1;