diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-31T21·20+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-31T21·20+0000 |
commit | 207bdcbe86bac5fb9e650d26b22ae33c667151e4 (patch) | |
tree | 9ef6560b23571b869214cb3cd2381c1d66f620b7 /src/libstore/gc.cc | |
parent | 252c9c91abe146e9c6b16d795c6566df4adafe56 (diff) |
* Automatically remove temporary root files.
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r-- | src/libstore/gc.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 222a1ff95cc2..af40e0b9286a 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -63,6 +63,15 @@ void addTempRoot(const Path & path) } +void removeTempRoots() +{ + if (fdTempRoots != -1) { + fdTempRoots.close(); + unlink(fnTempRoots.c_str()); + } +} + + typedef shared_ptr<AutoCloseFD> FDPtr; typedef list<FDPtr> FDs; @@ -94,7 +103,8 @@ static void readTempRoots(PathSet & tempRoots, FDs & fds) if (lockFile(*fd, ltWrite, false)) { printMsg(lvlError, format("removing stale temporary roots file `%1%'") % path); - /* !!! write token, unlink */ + unlink(path.c_str()); + writeFull(*fd, (const unsigned char *) "d", 1); continue; } |