diff options
Diffstat (limited to 'src/libstore/references.cc')
-rw-r--r-- | src/libstore/references.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libstore/references.cc b/src/libstore/references.cc index ab743f76d2d3..2bea44131ec0 100644 --- a/src/libstore/references.cc +++ b/src/libstore/references.cc @@ -36,14 +36,10 @@ void checkPath(const string & path, throw SysError(format("getting attributes of path `%1%'") % path); if (S_ISDIR(st.st_mode)) { - AutoCloseDir dir = opendir(path.c_str()); - - struct dirent * dirent; - while (errno = 0, dirent = readdir(dir)) { - string name = dirent->d_name; - if (name == "." || name == "..") continue; - search(name, ids, seen); - checkPath(path + "/" + name, ids, seen); + Strings names = readDirectory(path); + for (Strings::iterator i = names.begin(); i != names.end(); i++) { + search(*i, ids, seen); + checkPath(path + "/" + *i, ids, seen); } } |