diff --git a/lib/vfs/direntry.c b/lib/vfs/direntry.c index f1eb3f7c3..904e79e4d 100644 --- a/lib/vfs/direntry.c +++ b/lib/vfs/direntry.c @@ -682,8 +682,12 @@ vfs_s_close (void *fh) } vfs_s_invalidate (me, super); } + if (file->handle != -1) + { close (file->handle); + file->handle = -1; + } vfs_s_free_inode (me, file->ino); vfs_s_free_fh (sub, fh); diff --git a/src/vfs/cpio/cpio.c b/src/vfs/cpio/cpio.c index 99534ae53..3b4f3a9af 100644 --- a/src/vfs/cpio/cpio.c +++ b/src/vfs/cpio/cpio.c @@ -213,8 +213,10 @@ cpio_free_archive (struct vfs_class *me, struct vfs_s_super *super) (void) me; if (arch->fd != -1) + { mc_close (arch->fd); - arch->fd = -1; + arch->fd = -1; + } g_slist_free_full (arch->deferred, g_free); arch->deferred = NULL; } diff --git a/src/vfs/extfs/extfs.c b/src/vfs/extfs/extfs.c index 4499fe673..4acf58a63 100644 --- a/src/vfs/extfs/extfs.c +++ b/src/vfs/extfs/extfs.c @@ -978,6 +978,7 @@ extfs_close (void *fh) int errno_code = 0; close (file->handle); + file->handle = -1; /* Commit the file if it has changed */ if (file->changed) diff --git a/src/vfs/tar/tar.c b/src/vfs/tar/tar.c index e04320347..cc6949eaf 100644 --- a/src/vfs/tar/tar.c +++ b/src/vfs/tar/tar.c @@ -327,7 +327,10 @@ tar_free_archive (struct vfs_class *me, struct vfs_s_super *archive) (void) me; if (arch->fd != -1) + { mc_close (arch->fd); + arch->fd = -1; + } } /* --------------------------------------------------------------------------------------------- */