mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Handles special errors from FlushFileBuffers() for Windows.
This commit is contained in:
parent
0433033c12
commit
eeea58b42a
1 changed files with 24 additions and 2 deletions
|
|
@ -810,8 +810,30 @@ int windows_fsync(int fd)
|
|||
}
|
||||
|
||||
if (!FlushFileBuffers(h)) {
|
||||
windows_errno(GetLastError());
|
||||
return -1;
|
||||
DWORD error = GetLastError();
|
||||
|
||||
switch (error) {
|
||||
case ERROR_INVALID_HANDLE :
|
||||
/*
|
||||
* FlushFileBuffers returns this error if the handle
|
||||
* doesn't support buffering, like the console output.
|
||||
*
|
||||
* We had report also for ATA-over-Ethernet reporting this
|
||||
* error.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
case ERROR_ACCESS_DENIED
|
||||
/*
|
||||
* FlushFileBuffers returns this error for read-only
|
||||
* data, that cannot have to be flushed.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
default:
|
||||
windows_errno(error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue