]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 8 Feb 2017 02:06:38 +0000 (21:06 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 8 Feb 2017 02:06:38 +0000 (21:06 -0500)
src/basic/conf-files.c
src/basic/dirent-util.c

index c0c22610d77c15b8b84dbe050bacf6b8fed3eb33..b5780194df5dfe94102bde642214b2131b96b592 100644 (file)
@@ -43,7 +43,6 @@ static int files_add(Hashmap *h, const char *root, const char *path, const char
         int r;
 
         assert(path);
-        assert(suffix);
 
         dirpath = prefix_roota(root, path);
 
@@ -94,7 +93,6 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
         int r;
 
         assert(strv);
-        assert(suffix);
 
         /* This alters the dirs string array */
         if (!path_strv_resolve_uniq(dirs, root))
@@ -126,7 +124,6 @@ int conf_files_list_strv(char ***strv, const char *suffix, const char *root, con
         _cleanup_strv_free_ char **copy = NULL;
 
         assert(strv);
-        assert(suffix);
 
         copy = strv_copy((char**) dirs);
         if (!copy)
index 59067121b74f0c93c56a27673eeb1c7cfa109e12..6b9d26773ea78868a50fdb662bb6ba8ea559bd64 100644 (file)
@@ -70,5 +70,8 @@ bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) {
         if (de->d_name[0] == '.')
                 return false;
 
+        if (!suffix)
+                return true;
+
         return endswith(de->d_name, suffix);
 }