Forgot to close files after copy or error.
Former-commit-id: 157ea611926a5d70d1b469714b6b27b78d513f4b
This commit is contained in:
parent
9415096975
commit
ce6a63647f
|
|
@ -157,6 +157,7 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath)
|
||||||
if (fd2 == -1)
|
if (fd2 == -1)
|
||||||
{
|
{
|
||||||
NazaraError("Fail to open output file (" + targetPath + "): " + NzGetLastSystemError()); // TODO: more info ?
|
NazaraError("Fail to open output file (" + targetPath + "): " + NzGetLastSystemError()); // TODO: more info ?
|
||||||
|
close(fd1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,6 +177,9 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath)
|
||||||
write(fd2,buffer,bytes);
|
write(fd2,buffer,bytes);
|
||||||
|
|
||||||
} while (bytes == 512);
|
} while (bytes == 512);
|
||||||
|
|
||||||
|
close(fd1);
|
||||||
|
close(fd2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NzFileImpl::Delete(const NzString& filePath)
|
bool NzFileImpl::Delete(const NzString& filePath)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue