chiark / gitweb /
Never call qsort on potentially NULL arrays
[elogind.git] / src / shared / conf-files.c
index 296e605761c79236b034a09f3aab8b5d0d5947d1..ed4070c662711cb1e3ae7f009b336e3ad9f19b3e 100644 (file)
@@ -127,14 +127,14 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
                 return -ENOMEM;
         }
 
-        qsort(files, hashmap_size(fh), sizeof(char *), base_cmp);
+        qsort_safe(files, hashmap_size(fh), sizeof(char *), base_cmp);
         *strv = files;
 
         hashmap_free(fh);
         return 0;
 }
 
-int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char **dirs) {
+int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char* const* dirs) {
         _cleanup_strv_free_ char **copy = NULL;
 
         assert(strv);