]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: use qsort_safe
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 10 Apr 2015 22:57:05 +0000 (18:57 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 12 Apr 2015 14:20:24 +0000 (10:20 -0400)
src/tmpfiles/tmpfiles.c

index ef13dcb7498d0478c570a7775b1949e2906d29f1..16114b26583caa719209073366fac572cba3aeff 100644 (file)
@@ -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;