summaryrefslogtreecommitdiffstats
path: root/main/logrotate/qsort.patch
blob: 1e932be1926d1a7561fa1d81e58dff3aca8326f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- ./logrotate.c.orig
+++ ./logrotate.c
@@ -117,11 +117,12 @@
     return 1;
 }
 
-#if defined(HAVE_STRPTIME) && defined(HAVE_QSORT_R)
-static int compGlobResult(const void *result1, const void *result2, void *data)  {
+#if defined(HAVE_STRPTIME)
+static struct compData qsort_data;
+static int compGlobResult(const void *result1, const void *result2)  {
 	struct tm time;
 	time_t t1, t2;
-	struct compData *d = (struct compData *) data;
+	struct compData *d = &qsort_data;
 	const char *r1 = *(const char **)(result1);
 	const char *r2 = *(const char **)(result2);
 
@@ -139,10 +140,9 @@
 }
 
 static void sortGlobResult(glob_t *result, int prefix_len, const char *dformat) {
-	struct compData d;
-	d.prefix_len = prefix_len;
-	d.dformat = dformat;
-	qsort_r(result->gl_pathv, result->gl_pathc, sizeof(char *), compGlobResult, &d);
+	qsort_data.prefix_len = prefix_len;
+	qsort_data.dformat = dformat;
+	qsort(result->gl_pathv, result->gl_pathc, sizeof(char *), compGlobResult);
 }
 #else
 static void sortGlobResult(glob_t *result, int prefix_len, const char *dformat) {