diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-05-23 21:39:15 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-06-21 19:29:43 +0200 |
commit | fb19a739d528651e6c78e198269ae856192ffc68 (patch) | |
tree | 91b27356cfa7a88c0f90ff58b23f049567749ab8 /src/util.c | |
parent | d0baa06fda52905c24d93df27a9f3e879fab4d0d (diff) |
util: introduce dirent_is_file()
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/util.c b/src/util.c index 4046938fcd..7f59021826 100644 --- a/src/util.c +++ b/src/util.c @@ -4181,6 +4181,20 @@ finish: return r; } +bool dirent_is_file(struct dirent *de) { + assert(de); + + if (ignore_file(de->d_name)) + return false; + + if (de->d_type != DT_REG && + de->d_type != DT_LNK && + de->d_type != DT_UNKNOWN) + return false; + + return true; +} + void execute_directory(const char *directory, DIR *d, char *argv[]) { DIR *_d = NULL; struct dirent *de; @@ -4214,12 +4228,7 @@ void execute_directory(const char *directory, DIR *d, char *argv[]) { pid_t pid; int k; - if (ignore_file(de->d_name)) - continue; - - if (de->d_type != DT_REG && - de->d_type != DT_LNK && - de->d_type != DT_UNKNOWN) + if (!dirent_is_file(de)) continue; if (asprintf(&path, "%s/%s", directory, de->d_name) < 0) { |