mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 14:05:58 +03:00
Merge pull request #663 from nextcloud/upstream/pr/6707
Windows: Release handle/fd when file open fails #6699
This commit is contained in:
commit
326c872ba7
1 changed files with 2 additions and 0 deletions
|
@ -272,10 +272,12 @@ bool FileSystem::openAndSeekFileSharedRead(QFile *file, QString *errorOrNull, qi
|
|||
int fd = _open_osfhandle((intptr_t)fileHandle, _O_RDONLY);
|
||||
if (fd == -1) {
|
||||
error = "could not make fd from handle";
|
||||
CloseHandle(fileHandle);
|
||||
return false;
|
||||
}
|
||||
if (!file->open(fd, QIODevice::ReadOnly, QFile::AutoCloseHandle)) {
|
||||
error = file->errorString();
|
||||
_close(fd); // implicitly closes fileHandle
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue