From df468d41448fa545166778e099d3d019638fadad Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:49:05 +1300 Subject: [PATCH] chip-cert: Don't add newline to binary output (#29979) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chip-cert: Don't add newline to binary output * Add parentheses for clarity Co-authored-by: Jonathan Mégevand <77852424+jmeg-sfy@users.noreply.github.com> --------- Co-authored-by: Jonathan Mégevand <77852424+jmeg-sfy@users.noreply.github.com> --- src/tools/chip-cert/GeneralUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/chip-cert/GeneralUtils.cpp b/src/tools/chip-cert/GeneralUtils.cpp index bdcb9774fb006b..fce285d678acbf 100644 --- a/src/tools/chip-cert/GeneralUtils.cpp +++ b/src/tools/chip-cert/GeneralUtils.cpp @@ -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);