summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-08-08 18:46:06 +0200
committerBram Moolenaar <Bram@vim.org>2010-08-08 18:46:06 +0200
commit3479c5dc48b192a7c8c2089c4ba0de5538ea8129 (patch)
treea298808a69c744c699ee01fb91c3d757aec32bca /src/fileio.c
parente2b590ebf618fb7dc15012579875c3d649dd74c1 (diff)
downloadvim-git-3479c5dc48b192a7c8c2089c4ba0de5538ea8129.tar.gz
Fixed: on MS-Windows sometimes files with number 4913 or higher are left
behind.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 2881cbc88..368fd7adf 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3744,6 +3744,22 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
* can't delete an open file. */
close(fd);
mch_remove(IObuff);
+# ifdef MSWIN
+ /* MS-Windows may trigger a virus scanner to open the
+ * file, we can't delete it then. Keep trying for half a
+ * second. */
+ {
+ int try;
+
+ for (try = 0; try < 10; ++try)
+ {
+ if (mch_lstat((char *)IObuff, &st) < 0)
+ break;
+ ui_delay(50L, TRUE); /* wait 50 msec */
+ mch_remove(IObuff);
+ }
+ }
+# endif
}
}
}