diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-19T17·27+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-19T17·27+0000 |
commit | 9898746ef3732979bf30e9048021b6232ddf15ac (patch) | |
tree | 77f1391387f0e28f5495104fed3e4227bbeb4af3 /src/libstore/references.cc | |
parent | fd7ac09f1073179d9ac439c3e9fb12a1bf00a7d5 (diff) |
* nix-env: a tool to manage user environments.
* Replace all directory reading code by a generic readDirectory() function.
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); } } |