From ce6a63647fa38e965902914f59ff999af8ef92bb Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Fri, 4 Jan 2013 15:54:39 +0100 Subject: [PATCH] Forgot to close files after copy or error. Former-commit-id: 157ea611926a5d70d1b469714b6b27b78d513f4b --- src/Nazara/Core/Posix/FileImpl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Nazara/Core/Posix/FileImpl.cpp b/src/Nazara/Core/Posix/FileImpl.cpp index 09584ceea..38935fe12 100644 --- a/src/Nazara/Core/Posix/FileImpl.cpp +++ b/src/Nazara/Core/Posix/FileImpl.cpp @@ -157,6 +157,7 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath) if (fd2 == -1) { NazaraError("Fail to open output file (" + targetPath + "): " + NzGetLastSystemError()); // TODO: more info ? + close(fd1); return false; } @@ -176,6 +177,9 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath) write(fd2,buffer,bytes); } while (bytes == 512); + + close(fd1); + close(fd2); } bool NzFileImpl::Delete(const NzString& filePath)