Skip to content

Commit 3cd9bca

Browse files
Fix unused-result warning on fread in dlt-system-processes
GCC -Werror=unused-result is not suppressed by (void) cast. Replace with an if-check on the return value. Signed-off-by: LUU QUANG MINH <Minh.LuuQuang@vn.bosch.com>
1 parent a373a8a commit 3cd9bca

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/system/dlt-system-processes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ void send_process(LogProcessOptions const *popts, int n)
8787
pFile = fopen(filename, "r");
8888

8989
if (pFile != NULL) {
90-
(void)fread(buffer, 1, sizeof(buffer) - 1, pFile);
90+
size_t nread = fread(buffer, 1, sizeof(buffer) - 1, pFile);
91+
buffer[nread] = '\0';
9192
fclose(pFile);
9293
}
9394

0 commit comments

Comments
 (0)