]> git.ipfire.org Git - pakfire.git/commitdiff
job: Call the finished handler in the main process
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 14:30:33 +0000 (14:30 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 14:30:33 +0000 (14:30 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/job.c

index df3be8ffd1d507d20b1dd569fca13d9211ff6aab..d837ad3551127207f5fabe2a0d0532e92c053ab4 100644 (file)
@@ -377,6 +377,9 @@ static int pakfire_job_finished(struct pakfire_job* job, int status) {
        if (r < 0)
                goto ERROR;
 
+       // Let the builder know this is finished
+       r = pakfire_builder_job_finished(job->builder, job);
+
 ERROR:
        if (xfer)
                pakfire_xfer_unref(xfer);
@@ -491,8 +494,8 @@ static int pakfire_job_exited(sd_event_source* s, const siginfo_t* si, void* dat
                        break;
        }
 
-       // Let the builder know this is finished
-       return pakfire_builder_job_finished(job->builder, job);
+       // Signal that the job has finished
+       return pakfire_job_finished(job, si->si_status);
 }
 
 static int pakfire_job_send_log(struct pakfire_job* job, int priority, const char* line, size_t length) {
@@ -594,7 +597,6 @@ static int pakfire_job_child(struct pakfire_job* job) {
        struct pakfire_ctx* ctx = NULL;
        struct pakfire_build* build = NULL;
        int build_flags = 0;
-       int status;
        int r;
 
        // Fetch our PID
@@ -659,12 +661,7 @@ static int pakfire_job_child(struct pakfire_job* job) {
        }
 
        // Run the build
-       status = pakfire_build_exec(build, job->pkg, pakfire_job_result, job);
-
-       // Signal that the job has finished
-       r = pakfire_job_finished(job, status);
-       if (r < 0)
-               goto ERROR;
+       r = pakfire_build_exec(build, job->pkg, pakfire_job_result, job);
 
 ERROR:
        if (build)