Mitigate a race condition in Windows when deleting files and directories.
original commit: 1a13def8d6570babe378f4c63b5a488fac58ed3f
This commit is contained in:
parent
5f704d57da
commit
6b1259cfef
2
LOG
2
LOG
|
@ -883,3 +883,5 @@
|
|||
so the reduced version checks that p is a procedure.
|
||||
Also make the same change for #2%for-each.
|
||||
cp0.ss, 4.ms
|
||||
- Mitigate a race condition in Windows when deleting files and directories.
|
||||
windows.c
|
||||
|
|
16
c/windows.c
16
c/windows.c
|
@ -408,10 +408,14 @@ int S_windows_rename(const char *oldpathname, const char *newpathname) {
|
|||
|
||||
int S_windows_rmdir(const char *pathname) {
|
||||
wchar_t wpathname[PATH_MAX];
|
||||
int rc;
|
||||
if (MultiByteToWideChar(CP_UTF8,0,pathname,-1,wpathname,PATH_MAX) == 0)
|
||||
return _rmdir(pathname);
|
||||
rc =_rmdir(pathname);
|
||||
else
|
||||
return _wrmdir(wpathname);
|
||||
rc = _wrmdir(wpathname);
|
||||
if (0 == rc)
|
||||
Sleep(0); // Give Windows time to delete the directory.
|
||||
return rc;
|
||||
}
|
||||
|
||||
int S_windows_stat64(const char *pathname, struct STATBUF *buffer) {
|
||||
|
@ -432,10 +436,14 @@ int S_windows_system(const char *command) {
|
|||
|
||||
int S_windows_unlink(const char *pathname) {
|
||||
wchar_t wpathname[PATH_MAX];
|
||||
int rc;
|
||||
if (MultiByteToWideChar(CP_UTF8,0,pathname,-1,wpathname,PATH_MAX) == 0)
|
||||
return _unlink(pathname);
|
||||
rc = _unlink(pathname);
|
||||
else
|
||||
return _wunlink(wpathname);
|
||||
rc = _wunlink(wpathname);
|
||||
if (0 == rc)
|
||||
Sleep(0); // Give Windows time to delete the file.
|
||||
return rc;
|
||||
}
|
||||
|
||||
char *S_windows_getcwd(char *buffer, int maxlen) {
|
||||
|
|
|
@ -1542,6 +1542,14 @@ in fasl files does not generally make sense.
|
|||
%-----------------------------------------------------------------------------
|
||||
\section{Bug Fixes}\label{section:bugfixes}
|
||||
|
||||
\subsection{Permission denied after deleting files or directories in Windows}
|
||||
|
||||
In Windows, deleting a file or directory briefly leaves the file or
|
||||
directory in a state where a subsequent create operation fails with
|
||||
permission denied. This race condition is now mitigated by a call to
|
||||
Sleep.
|
||||
[This bug applies to all versions up to 9.5 on Windows 7 and later.]
|
||||
|
||||
\subsection{Incorrect handling of offset in
|
||||
\protect\scheme{date->time-utc} on Windows (9.5)}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user