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