From 96483cba176ed39d53575cb3da6b6e3cbde5aef6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 5 Nov 2023 18:33:21 +0000 Subject: [PATCH 1/1] parse: Remove any trailing line breaks Signed-off-by: Michael Tremer --- src/libpakfire/parse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libpakfire/parse.c b/src/libpakfire/parse.c index 7745e9f5..64820f4b 100644 --- a/src/libpakfire/parse.c +++ b/src/libpakfire/parse.c @@ -46,6 +46,11 @@ int pakfire_parse_file(const char* path, pakfire_parse_line parse, void* data) { if (bytes_read < 0) break; + // Remove the trailing newline + if (line[length - 1] == '\n') + line[--length] = '\0'; + + // Call the parse callback function r = parse(line, length, data); if (r) goto ERROR; -- 2.39.2