chiark / gitweb /
basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix
[elogind.git] / src / basic / dirent-util.c
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);
 }