summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-11-27 19:02:34 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-11-27 19:02:34 +0000
commit2c44eb5822e7ab6281123290184df4542da5cdb1 (patch)
treeede5fae13d2cfe2f4ad9153488a9ee5d873e3f04
parentc43815deca9be44c9d8ef39ee1c4a100d5ae0331 (diff)
downloads6-rc-2c44eb5822e7ab6281123290184df4542da5cdb1.tar.xz
Fix qsort invocation, now services are really sorted...
-rw-r--r--src/s6-rc/s6-rc-compile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c
index a07a6f2..1d65db5 100644
--- a/src/s6-rc/s6-rc-compile.c
+++ b/src/s6-rc/s6-rc-compile.c
@@ -487,6 +487,11 @@ static inline void add_source (before_t *be, int dirfd, char const *srcdir, char
else strerr_dief6x(1, "invalid ", srcdir, "/", name, "/type", ": must be oneshot, longrun, or bundle") ;
}
+static int qsort_cannot_use_strcmp_directly (void const *a, void const *b)
+{
+ return strcmp(*(char const *const *)a, *(char const *const *)b) ;
+}
+
static inline void add_sources (before_t *be, char const *srcdir, stralloc *sa)
{
unsigned int n = 0 ;
@@ -521,7 +526,7 @@ static inline void add_sources (before_t *be, char const *srcdir, stralloc *sa)
names[i] = sa->s + pos ;
pos += strlen(sa->s + pos) + 1 ;
}
- qsort(names, n, sizeof(char const *), (int (*)(const void *, const void *))&strcmp) ;
+ qsort(names, n, sizeof(char const *), &qsort_cannot_use_strcmp_directly) ;
for (unsigned int i = 0 ; i < n ; i++)
{
int fd = open_readatb(fdsrc, names[i]) ;