File librsync-noexecstack-nestedfunc.patch of Package librsync

--- librsync-0.9.7.orig/search.c
+++ librsync-0.9.7/search.c
@@ -54,29 +54,30 @@
 #define gettag2(s1,s2) (((s1) + (s2)) & 0xFFFF)
 #define gettag(sum) gettag2((sum)&0xFFFF,(sum)>>16)
 
+
+static int rs_compare_targets(void const *a1, void const *a2, void *arg)
+{
+    rs_target_t const *t1 = a1; 
+    rs_target_t const *t2 = a2;
+    rs_signature_t const *sums = arg;
+
+    int v = (int) t1->t - (int) t2->t;
+    if (v != 0)
+        return v;
+
+    rs_weak_sum_t w1 = sums->block_sigs[t1->i].weak_sum;
+    rs_weak_sum_t w2 = sums->block_sigs[t2->i].weak_sum;
+
+    v = (w1 > w2) - (w1 < w2);
+    if (v != 0)
+        return v;
+
+    return memcmp(sums->block_sigs[t1->i].strong_sum, sums->block_sigs[t2->i].strong_sum, sums->strong_sum_len);
+}
+
 rs_result
 rs_build_hash_table(rs_signature_t * sums)
 {
-    int rs_compare_targets(void const *a1, void const *a2) {
-	rs_target_t const *t1 = a1;
-	rs_target_t const *t2 = a2;
-
-	int v = (int) t1->t - (int) t2->t;
-	if (v != 0)
-	    return v;
-
-	rs_weak_sum_t w1 = sums->block_sigs[t1->i].weak_sum;
-	rs_weak_sum_t w2 = sums->block_sigs[t2->i].weak_sum;
-
-	v = (w1 > w2) - (w1 < w2);
-	if (v != 0)
-	    return v;
-
-	return memcmp(sums->block_sigs[t1->i].strong_sum,
-		sums->block_sigs[t2->i].strong_sum,
-		sums->strong_sum_len);
-    }
-
     int i;
 
     sums->tag_table = calloc(TABLE_SIZE, sizeof(sums->tag_table[0]));
@@ -96,9 +97,9 @@ rs_build_hash_table(rs_signature_t * sum
 	    sums->targets[i].t = gettag(sums->block_sigs[i].weak_sum);
 	}
 
-	qsort(sums->targets, sums->count,
+	qsort_r(sums->targets, sums->count,
 	      sizeof(sums->targets[0]),
-              rs_compare_targets);
+              rs_compare_targets, sums);
     }
 
     for (i = 0; i < TABLE_SIZE; i++) {
openSUSE Build Service is sponsored by