teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
diff --git a/build/pack.c b/build/pack.c
index 447e3ec94..21f22d5ca 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -742,25 +742,28 @@ static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int ch
 rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
 {
     rpmRC rc = RPMRC_OK;
-    Package pkg;
 
     /* Run binary creation in parallel */
     #pragma omp parallel
-    #pragma omp single
-    for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
-	#pragma omp task
+    {
+	#pragma omp single
 	{
-	pkg->rc = packageBinary(spec, pkg, cookie, cheating, &pkg->filename);
-	rpmlog(RPMLOG_DEBUG,
-		_("Finished binary package job, result %d, filename %s\n"),
-		pkg->rc, pkg->filename);
-	if (pkg->rc) {
-	    #pragma omp critical
-	    rc = pkg->rc;
+	for (Package pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
+	    #pragma omp task
+	    {
+	    pkg->rc = packageBinary(spec, pkg, cookie, cheating, &pkg->filename);
+	    rpmlog(RPMLOG_DEBUG,
+		    _("Finished binary package job, result %d, filename %s\n"),
+		    pkg->rc, pkg->filename);
+	    if (pkg->rc) {
+		#pragma omp critical
+		rc = pkg->rc;
+	    }
+	    } /* omp task */
+	    if (rc)
+		break;
+	}
 	}
-	} /* omp task */
-	if (rc)
-	    break;
     }
 
     /* Now check the package set if enabled */