chiark / gitweb /
shared: remove now unused function
[elogind.git] / src / shared / path-util.c
index 70c8a8af06f9b2ea9db57784db96a405dc272e88..ae12c05317f4d34a4f3ae74a52afa46ac3f38e07 100644 (file)
@@ -181,6 +181,7 @@ char **path_strv_canonicalize(char **l) {
 
                 t = path_make_absolute_cwd(*s);
                 free(*s);
+                *s = NULL;
 
                 if (!t) {
                         enomem = true;
@@ -189,13 +190,17 @@ char **path_strv_canonicalize(char **l) {
 
                 errno = 0;
                 u = canonicalize_file_name(t);
-                free(t);
 
                 if (!u) {
-                        if (errno == ENOMEM || !errno)
-                                enomem = true;
-
-                        continue;
+                        if (errno == ENOENT)
+                                u = t;
+                        else {
+                                free(t);
+                                if (errno == ENOMEM || !errno)
+                                        enomem = true;
+
+                                continue;
+                        }
                 }
 
                 l[k++] = u;
@@ -209,26 +214,6 @@ char **path_strv_canonicalize(char **l) {
         return l;
 }
 
-char **path_strv_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;
-}
-
 char *path_kill_slashes(char *path) {
         char *f, *t;
         bool slash = false;