mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-09 21:12:07 +03:00
* 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:
parent
7532ed2827
commit
2665057b7c
@ -1,5 +1,11 @@
|
|||||||
2003-01-20 Pavel Roskin <proski@gnu.org>
|
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
|
* screen.c (string_file_size_brief): Represent non-regular files
|
||||||
of unknown kind by '?'.
|
of unknown kind by '?'.
|
||||||
(file_compute_color): Use for them the same color as for stale
|
(file_compute_color): Use for them the same color as for stale
|
||||||
|
@ -383,12 +383,11 @@ handle_dirent (dir_list *list, char *filter, struct dirent *dp,
|
|||||||
return 0;
|
return 0;
|
||||||
if (mc_lstat (dp->d_name, buf1) == -1) {
|
if (mc_lstat (dp->d_name, buf1) == -1) {
|
||||||
/*
|
/*
|
||||||
* lstat() fails - wildly assume that it's a directory.
|
* lstat() fails - such entries should be identified by
|
||||||
* It can happen on QNX Neutrino for /fs/cd0 if no CD is inserted.
|
* buf1->st_mode being 0.
|
||||||
|
* It happens on QNX Neutrino for /fs/cd0 if no CD is inserted.
|
||||||
*/
|
*/
|
||||||
memset (buf1, 0, sizeof (buf1));
|
memset (buf1, 0, sizeof (*buf1));
|
||||||
buf1->st_mode = S_IFDIR | 0777;
|
|
||||||
buf1->st_nlink = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S_ISDIR (buf1->st_mode))
|
if (S_ISDIR (buf1->st_mode))
|
||||||
|
@ -1929,8 +1929,12 @@ do_enter_on_file_entry (file_entry *fe)
|
|||||||
{
|
{
|
||||||
char *full_name;
|
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))
|
if (!do_cd (fe->fname, cd_exact))
|
||||||
message (1, MSG_ERROR, _("Cannot change directory"));
|
message (1, MSG_ERROR, _("Cannot change directory"));
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user