]> git.ipfire.org Git - pakfire.git/commitdiff
log stream: Expect the callback to consume the entire line
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Mar 2025 16:57:36 +0000 (16:57 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Mar 2025 16:57:36 +0000 (16:57 +0000)
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 <michael.tremer@ipfire.org>
src/pakfire/build.c
src/pakfire/log_stream.c

index 9caf2d50a2496b36103838cce2ea4b0e2d570bcd..d9e62434f71b3b6a4badcc1944f2871064bd9c55 100644 (file)
@@ -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,
index 2cf3683244ceba0d37de04ca4cceac1ce19d7c06..e46158eb448ebe98f6529ca1c4849db08f9b14fa 100644 (file)
@@ -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);