util-linux: use qsort instead of qsort_r to fix compile error with musl
[openwrt/staging/yousong.git] / package / utils / util-linux / patches / 100-fdisk_use_qsort.patch
1 --- a/libfdisk/src/sun.c
2 +++ b/libfdisk/src/sun.c
3 @@ -361,10 +361,10 @@ static void fetch_sun(struct fdisk_conte
4 }
5 }
6
7 -static int verify_sun_cmp(int *a, int *b, void *data)
8 -{
9 - unsigned int *verify_sun_starts = (unsigned int *) data;
10 +static unsigned int *verify_sun_starts;
11
12 +static int verify_sun_cmp(int *a, int *b)
13 +{
14 if (*a == -1)
15 return 1;
16 if (*b == -1)
17 @@ -379,7 +379,6 @@ static int sun_verify_disklabel(struct f
18 uint32_t starts[SUN_MAXPARTITIONS], lens[SUN_MAXPARTITIONS], start, stop;
19 uint32_t i,j,k,starto,endo;
20 int array[SUN_MAXPARTITIONS];
21 - unsigned int *verify_sun_starts;
22
23 assert(cxt);
24 assert(cxt->label);
25 @@ -427,9 +426,8 @@ static int sun_verify_disklabel(struct f
26 else
27 array[i] = -1;
28 }
29 - qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
30 - (int (*)(const void *,const void *,void *)) verify_sun_cmp,
31 - verify_sun_starts);
32 + qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
33 + (int (*)(const void *,const void *)) verify_sun_cmp);
34
35 if (array[0] == -1) {
36 fdisk_info(cxt, _("No partitions defined."));