ios: Always reset IOSIntermediateDumpWriter file descriptor on close.

Always reset the file descriptor to -1, even if FlushWriteBuffer or
RawLoggingCloseFile fails.

Bug: 1431760
Change-Id: I193f526d65f477bba002dd9faf68996020e48a3b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4406657
Reviewed-by: Ben Hamilton <benhamilton@google.com>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Justin Cohen 2023-04-10 14:19:23 -04:00 committed by Crashpad LUCI CQ
parent 4773a37f0a
commit ada8dfa4a7

View File

@ -83,12 +83,10 @@ bool IOSIntermediateDumpWriter::Close() {
if (fd_ < 0) {
return true;
}
if (!FlushWriteBuffer()) {
return false;
}
int fd = fd_;
const bool flushed = FlushWriteBuffer();
const bool closed = RawLoggingCloseFile(fd_);
fd_ = -1;
return RawLoggingCloseFile(fd);
return flushed && closed;
}
bool IOSIntermediateDumpWriter::AddPropertyCString(IntermediateDumpKey key,