diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-04-25 23:44:34 -0400 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-07-25 09:46:52 +0200 |
commit | 42031136036b3da794a2575d91de8378931141ed (patch) | |
tree | aef2171cd6fd299843f5336307b3b4d61e073da5 /src/basic/dirent-util.h | |
parent | 8fdbd4fdbdf791d9ede56035a67bfa25454f07d2 (diff) |
basic: add readdir_no_dot and safe_glob functions
safe_glob filters out "." and "..".
This converts all users of glob_extend() and glob_exists() to safe_glob.
Diffstat (limited to 'src/basic/dirent-util.h')
-rw-r--r-- | src/basic/dirent-util.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/dirent-util.h b/src/basic/dirent-util.h index b91d04908..18b9db9b2 100644 --- a/src/basic/dirent-util.h +++ b/src/basic/dirent-util.h @@ -31,6 +31,8 @@ int dirent_ensure_type(DIR *d, struct dirent *de); bool dirent_is_file(const struct dirent *de) _pure_; bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_; +struct dirent* readdir_no_dot(DIR *dirp); + #define FOREACH_DIRENT(de, d, on_error) \ for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \ if (!de) { \ |