chiark / gitweb /
lookup: drop empty directories from search paths
[elogind.git] / src / util.c
index 5029896ef0635d507fcb9bc8e6e10dab537c81d3..6037455f705fd3e6f0dd40eb8f9091dc7fb8bf55 100644 (file)
@@ -1209,6 +1209,26 @@ char **strv_path_canonicalize(char **l) {
         return l;
 }
 
+char **strv_path_remove_empty(char **l) {
+        char **f, **t;
+
+        if (!l)
+                return NULL;
+
+        for (f = t = l; *f; f++) {
+
+                if (dir_is_empty(*f) > 0) {
+                        free(*f);
+                        continue;
+                }
+
+                *(t++) = *f;
+        }
+
+        *t = NULL;
+        return l;
+}
+
 int reset_all_signal_handlers(void) {
         int sig;