ClosePlatformFile() on non-Windows: Return true on success, false on failure
We already did this on Windows, but elsewhere we were returning false on success and true on failure, because close() returns 0 on success and -1 on failure, and we were letting that value implicitly convert to bool. Bug: webrtc:8719 Change-Id: I417ff207db8d1fa4cf73a49f1d53762a8066da6c Reviewed-on: https://webrtc-review.googlesource.com/56660 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22150}
This commit is contained in:
parent
518716fd73
commit
0404225d15
@ -63,7 +63,7 @@ FILE* FdopenPlatformFileForWriting(PlatformFile file) {
|
||||
}
|
||||
|
||||
bool ClosePlatformFile(PlatformFile file) {
|
||||
return close(file);
|
||||
return close(file) == 0;
|
||||
}
|
||||
|
||||
bool RemoveFile(const std::string& path) {
|
||||
|
||||
@ -35,7 +35,7 @@ extern const PlatformFile kInvalidPlatformFileValue;
|
||||
// the PlatformFile should no longer be used.
|
||||
FILE* FdopenPlatformFileForWriting(PlatformFile file);
|
||||
|
||||
// Closes a PlatformFile.
|
||||
// Closes a PlatformFile. Returns true on success, false on failure.
|
||||
// Don't use ClosePlatformFile to close a file opened with FdopenPlatformFile.
|
||||
// Use fclose instead.
|
||||
bool ClosePlatformFile(PlatformFile file);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user