Partly revert the last change - low-level chdir actually writes to
the "directory" argument, so preserve it.
Этот коммит содержится в:
родитель
075d359907
Коммит
423849f74d
12
vfs/vfs.c
12
vfs/vfs.c
@ -883,17 +883,23 @@ vfs_add_current_stamps (void)
|
|||||||
int
|
int
|
||||||
mc_chdir (char *path)
|
mc_chdir (char *path)
|
||||||
{
|
{
|
||||||
char *new_dir;
|
char *new_dir, *new_dir_copy;
|
||||||
vfs *old_vfs, *new_vfs;
|
vfs *old_vfs, *new_vfs;
|
||||||
vfsid old_vfsid;
|
vfsid old_vfsid;
|
||||||
struct vfs_stamping *parent;
|
struct vfs_stamping *parent;
|
||||||
|
int result;
|
||||||
|
|
||||||
new_dir = vfs_canon (path);
|
new_dir = vfs_canon (path);
|
||||||
new_vfs = vfs_type (new_dir);
|
new_vfs = vfs_type (new_dir);
|
||||||
if (!new_vfs->chdir)
|
if (!new_vfs->chdir)
|
||||||
vfs_die ("No chdir function defined");
|
vfs_die ("No chdir function defined");
|
||||||
|
|
||||||
if ((*new_vfs->chdir) (new_vfs, new_dir) == -1) {
|
/* new_vfs->chdir can write to the second argument, use a copy */
|
||||||
|
new_dir_copy = g_strdup (new_dir);
|
||||||
|
result = (*new_vfs->chdir) (new_vfs, new_dir_copy);
|
||||||
|
g_free (new_dir_copy);
|
||||||
|
|
||||||
|
if (result == -1) {
|
||||||
errno = ferrno (new_vfs);
|
errno = ferrno (new_vfs);
|
||||||
g_free (new_dir);
|
g_free (new_dir);
|
||||||
return -1;
|
return -1;
|
||||||
@ -907,7 +913,7 @@ mc_chdir (char *path)
|
|||||||
current_dir = new_dir;
|
current_dir = new_dir;
|
||||||
current_vfs = new_vfs;
|
current_vfs = new_vfs;
|
||||||
|
|
||||||
/* This function uses current_dir internally */
|
/* This function uses the new current_dir implicitly */
|
||||||
vfs_add_noncurrent_stamps (old_vfs, old_vfsid, parent);
|
vfs_add_noncurrent_stamps (old_vfs, old_vfsid, parent);
|
||||||
vfs_rm_parents (parent);
|
vfs_rm_parents (parent);
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user