Skip to content

Commit

Permalink
chip-cert: Don't add newline to binary output (#29979)
Browse files Browse the repository at this point in the history
* chip-cert: Don't add newline to binary output

* Add parentheses for clarity

Co-authored-by: Jonathan Mégevand <[email protected]>

---------

Co-authored-by: Jonathan Mégevand <[email protected]>
  • Loading branch information
ksperling-apple and jmeg-sfy authored Oct 26, 2023
1 parent 38e459b commit df468d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tools/chip-cert/GeneralUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ bool WriteDataIntoFile(const char * fileName, const uint8_t * data, size_t dataL
ExitNow(res = false);
}

// Add new line if the output is stdout
if ((strcmp(fileName, "-") == 0) && (fwrite("\n", 1, 1, file) != 1))
// Add new line if the output is to stdout in a text format
if ((strcmp(fileName, "-") == 0) && (dataFmt != kDataFormat_Raw) && (fwrite("\n", 1, 1, file) != 1))
{
fprintf(stderr, "Unable to write to %s: %s\n", fileName, strerror(ferror(file) ? errno : ENOSPC));
ExitNow(res = false);
Expand Down

0 comments on commit df468d4

Please sign in to comment.