diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-27 01:48:17 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-27 13:25:58 +0100 |
commit | 7d50b32a129e781401cf897475f388f682de1368 (patch) | |
tree | 19ccd3483828076177108fe2ec012c52f3f7dd9e /src/basic/util.c | |
parent | 872a590ef83b23a65071242a8082d25d5efa6db6 (diff) |
util-lib: split out globbing related calls into glob-util.[ch]
Diffstat (limited to 'src/basic/util.c')
-rw-r--r-- | src/basic/util.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index 412ea50b96..6da311ad1e 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -23,7 +23,6 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> -#include <glob.h> #include <grp.h> #include <langinfo.h> #include <libintl.h> @@ -368,49 +367,6 @@ int socket_from_display(const char *display, char **path) { return 0; } -int glob_exists(const char *path) { - _cleanup_globfree_ glob_t g = {}; - int k; - - assert(path); - - errno = 0; - k = glob(path, GLOB_NOSORT|GLOB_BRACE, NULL, &g); - - if (k == GLOB_NOMATCH) - return 0; - else if (k == GLOB_NOSPACE) - return -ENOMEM; - else if (k == 0) - return !strv_isempty(g.gl_pathv); - else - return errno ? -errno : -EIO; -} - -int glob_extend(char ***strv, const char *path) { - _cleanup_globfree_ glob_t g = {}; - int k; - char **p; - - errno = 0; - k = glob(path, GLOB_NOSORT|GLOB_BRACE, NULL, &g); - - if (k == GLOB_NOMATCH) - return -ENOENT; - else if (k == GLOB_NOSPACE) - return -ENOMEM; - else if (k != 0 || strv_isempty(g.gl_pathv)) - return errno ? -errno : -EIO; - - STRV_FOREACH(p, g.gl_pathv) { - k = strv_extend(strv, *p); - if (k < 0) - break; - } - - return k; -} - int block_get_whole_disk(dev_t d, dev_t *ret) { char *p, *s; int r; |