summaryrefslogtreecommitdiff
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-04-10 18:57:05 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-04-12 10:20:24 -0400
commitdd449aca6182ff49aa11701e47928c9df36be16a (patch)
tree456393341425002c4c08dcfc6cd63b7d0fc391af /src/tmpfiles
parent7a03974a6f4510dcb1850515a80c2063c767a80f (diff)
downloadsystemd-dd449aca6182ff49aa11701e47928c9df36be16a.tar.gz
tmpfiles: use qsort_safe
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index ef13dcb749..16114b2658 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1635,17 +1635,6 @@ static int item_compare(const void *a, const void *b) {
return (int) x->type - (int) y->type;
}
-static void item_array_sort(ItemArray *a) {
-
- /* Sort an item array, to enforce stable ordering in which we
- * apply things. */
-
- if (a->count <= 1)
- return;
-
- qsort(a->items, a->count, sizeof(Item), item_compare);
-}
-
static bool item_compatible(Item *a, Item *b) {
assert(a);
assert(b);
@@ -1980,7 +1969,9 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
return log_oom();
memcpy(existing->items + existing->count++, &i, sizeof(i));
- item_array_sort(existing);
+
+ /* Sort item array, to enforce stable ordering of application */
+ qsort_safe(existing->items, existing->count, sizeof(Item), item_compare);
zero(i);
return 0;