Skip to content

Commit

Permalink
Skip flushing buffer in error case
Browse files Browse the repository at this point in the history
If there was a parsing error, the buffer has random stuff in it and
shouldn't be flushed to disk

Introduced in 9b0d3fb
  • Loading branch information
kattrali committed Dec 16, 2017
1 parent 5193dbb commit 556ae89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashState.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ bool bsg_kscrashstate_i_saveState(const BSG_KSCrash_State *const state,
goto done;
}
result = bsg_ksjsonendEncode(&JSONContext);

done:
if (!bsg_ksfuflushWriteBuffer(fd)) {
BSG_KSLOG_ERROR("Failed to flush write buffer");
}

done:
close(fd);

if (result != BSG_KSJSON_OK) {
Expand Down

0 comments on commit 556ae89

Please sign in to comment.