diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-19 17:27:16 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-19 17:27:16 +0000 |
commit | 9898746ef3732979bf30e9048021b6232ddf15ac (patch) | |
tree | 77f1391387f0e28f5495104fed3e4227bbeb4af3 /src/libstore | |
parent | fd7ac09f1073179d9ac439c3e9fb12a1bf00a7d5 (diff) | |
download | guix-9898746ef3732979bf30e9048021b6232ddf15ac.tar.gz |
* nix-env: a tool to manage user environments.
* Replace all directory reading code by a generic readDirectory() function.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/db.cc | 4 | ||||
-rw-r--r-- | src/libstore/globals.cc | 1 | ||||
-rw-r--r-- | src/libstore/globals.hh | 3 | ||||
-rw-r--r-- | src/libstore/references.cc | 12 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/libstore/db.cc b/src/libstore/db.cc index 63ec2724fc..a97111a3a9 100644 --- a/src/libstore/db.cc +++ b/src/libstore/db.cc @@ -166,7 +166,7 @@ void Database::open(const string & path) /* The following code provides automatic recovery of the database environment. Recovery is necessary when a process dies while it has the database open. To detect this, - processes atomically increment a counter when the open the + processes atomically increment a counter when they open the database, and decrement it when they close it. If we see that counter is > 0 but no processes are accessing the database---determined by attempting to obtain a write lock @@ -199,7 +199,7 @@ void Database::open(const string & path) other readers or writers. */ int n = getAccessorCount(fdAccessors); - setAccessorCount(fdAccessors, 1); + setAccessorCount(fdAccessors, 1); if (n != 0) { printMsg(lvlTalkative, diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index a292b49aea..e5d76ff485 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -3,6 +3,7 @@ string nixStore = "/UNINIT"; string nixDataDir = "/UNINIT"; string nixLogDir = "/UNINIT"; +string nixStateDir = "/UNINIT"; string nixDBPath = "/UNINIT"; bool keepFailed = false; diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 1b4d0bde3f..3da294cc82 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -16,6 +16,9 @@ extern string nixDataDir; /* !!! fix */ /* nixLogDir is the directory where we log various operations. */ extern string nixLogDir; +/* nixStateDir is the directory where state is stored. */ +extern string nixStateDir; + /* nixDBPath is the path name of our Berkeley DB environment. */ extern string nixDBPath; diff --git a/src/libstore/references.cc b/src/libstore/references.cc index ab743f76d2..2bea44131e 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); } } |