From: Michael Tremer Date: Sat, 22 Mar 2025 16:57:36 +0000 (+0000) Subject: log stream: Expect the callback to consume the entire line X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=919269fda3733a40f76b1198bcae8f015bdbfc37;p=pakfire.git log stream: Expect the callback to consume the entire line This is otherwise getting out of hand and we should not have a place where this would become an issue. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/build.c b/src/pakfire/build.c index 9caf2d50..d9e62434 100644 --- a/src/pakfire/build.c +++ b/src/pakfire/build.c @@ -149,7 +149,7 @@ static int pakfire_build_output_callback( else INFO(ctx, "[ %02u.%04u] %.*s", s, ms, (int)length, buffer); - return length; + return 0; } static int __pakfire_build_setup_repo(struct pakfire* pakfire, @@ -357,7 +357,7 @@ static int pakfire_build_process_pkgconfig_dep(struct pakfire_package* pkg, return r; } - return length; + return 0; } static int pakfire_build_process_pkgconfig_provides( @@ -717,14 +717,8 @@ static int pakfire_build_find_perl_files( static int pakfire_build_add_perl_dep(struct pakfire_ctx* ctx, struct pakfire_package* pkg, const enum pakfire_package_key key, const char* line, size_t length) { - int r; - // Add the dependency - r = pakfire_package_add_dep(pkg, key, "%.*s", (int)length, line); - if (r < 0) - return r; - - return length; + return pakfire_package_add_dep(pkg, key, "%.*s", (int)length, line); } static int pakfire_build_add_perl_provides(struct pakfire_ctx* ctx, @@ -1012,9 +1006,7 @@ static int pakfire_build_process_scriptlet_dep( // Ignore if the string was presumed to be invalid (some other format) case EINVAL: DEBUG(ctx, "Ignoring invalid line %.*s\n", (int)length, line); - - // Consume the entire line - return length; + return 0; default: return r; @@ -1043,8 +1035,7 @@ static int pakfire_build_process_scriptlet_dep( } } - // Consume the entire line - return length; + return 0; } static int pakfire_build_add_scriptlet_requires(struct pakfire_build* build, diff --git a/src/pakfire/log_stream.c b/src/pakfire/log_stream.c index 2cf36832..e46158eb 100644 --- a/src/pakfire/log_stream.c +++ b/src/pakfire/log_stream.c @@ -280,7 +280,7 @@ static int pakfire_log_stream_drain_buffer(struct pakfire_log_stream* stream) { // Call the callback r = stream->callback(stream->ctx, stream->data, line, r); - if (r) + if (r < 0) return r; memmove(stream->buffer, stream->buffer + length, stream->buffered - length);