VFS: invalidate file descriptors after close.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-05-11 11:15:59 +03:00
parent 7d80e8a175
commit 7548679271
4 changed files with 11 additions and 1 deletions

View File

@ -682,8 +682,12 @@ vfs_s_close (void *fh)
} }
vfs_s_invalidate (me, super); vfs_s_invalidate (me, super);
} }
if (file->handle != -1) if (file->handle != -1)
{
close (file->handle); close (file->handle);
file->handle = -1;
}
vfs_s_free_inode (me, file->ino); vfs_s_free_inode (me, file->ino);
vfs_s_free_fh (sub, fh); vfs_s_free_fh (sub, fh);

View File

@ -213,8 +213,10 @@ cpio_free_archive (struct vfs_class *me, struct vfs_s_super *super)
(void) me; (void) me;
if (arch->fd != -1) if (arch->fd != -1)
{
mc_close (arch->fd); mc_close (arch->fd);
arch->fd = -1; arch->fd = -1;
}
g_slist_free_full (arch->deferred, g_free); g_slist_free_full (arch->deferred, g_free);
arch->deferred = NULL; arch->deferred = NULL;
} }

View File

@ -978,6 +978,7 @@ extfs_close (void *fh)
int errno_code = 0; int errno_code = 0;
close (file->handle); close (file->handle);
file->handle = -1;
/* Commit the file if it has changed */ /* Commit the file if it has changed */
if (file->changed) if (file->changed)

View File

@ -327,7 +327,10 @@ tar_free_archive (struct vfs_class *me, struct vfs_s_super *archive)
(void) me; (void) me;
if (arch->fd != -1) if (arch->fd != -1)
{
mc_close (arch->fd); mc_close (arch->fd);
arch->fd = -1;
}
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */