diff options
author | Reverend Homer <mk.43.ecko@gmail.com> | 2016-12-09 10:04:30 +0100 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-12-09 10:04:30 +0100 |
commit | 8fb3f0099787a5b48213c4e2aa42d8ff61b0c7f1 (patch) | |
tree | c9bf990e18daac08ec1e744d6be365a9e98d2532 /src/delta/delta.c | |
parent | Merge pull request #4686 from poettering/machine-id-app-specific (diff) | |
download | systemd-8fb3f0099787a5b48213c4e2aa42d8ff61b0c7f1.tar.xz systemd-8fb3f0099787a5b48213c4e2aa42d8ff61b0c7f1.zip |
tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853)
Diffstat (limited to 'src/delta/delta.c')
-rw-r--r-- | src/delta/delta.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/delta/delta.c b/src/delta/delta.c index 107b105fde..9a44b15da7 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -297,6 +297,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const char *path, bool dropins) { _cleanup_closedir_ DIR *d; + struct dirent *de; assert(top); assert(bottom); @@ -313,16 +314,10 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch return log_error_errno(errno, "Failed to open %s: %m", path); } - for (;;) { - struct dirent *de; + FOREACH_DIRENT_ALL(de, d, return -errno) { int k; char *p; - errno = 0; - de = readdir(d); - if (!de) - return -errno; - dirent_ensure_type(d, de); if (dropins && de->d_type == DT_DIR && endswith(de->d_name, ".d")) @@ -354,6 +349,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch return k; } } + return 0; } static int should_skip_prefix(const char* p) { |