diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-12-30 13:08:14 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-12-30 13:08:14 +0000 |
commit | 254b3399ba3d7cf161fa54f9cf6cdc65c17164fb (patch) | |
tree | 4c0f9133e5b2f489ca18632686773dff6fb6a87b /src/libutil | |
parent | 56790411323eada03bacf37fe6fd328a7c84d32a (diff) | |
parent | 8c42a8c8ff2986940a41d46b0bdaa1c2ff0f15ad (diff) |
* Sync with the trunk.
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 10 | ||||
-rw-r--r-- | src/libutil/util.hh | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 9adaac40d..0352754f5 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -701,7 +701,7 @@ AutoCloseDir::AutoCloseDir(DIR * dir) AutoCloseDir::~AutoCloseDir() { - if (dir) closedir(dir); + close(); } @@ -717,6 +717,14 @@ AutoCloseDir::operator DIR *() } +void AutoCloseDir::close() +{ + if (dir) { + closedir(dir); + dir = 0; + } +} + ////////////////////////////////////////////////////////////////////// diff --git a/src/libutil/util.hh b/src/libutil/util.hh index f86290f31..a1cf68e69 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -223,6 +223,7 @@ public: ~AutoCloseDir(); void operator =(DIR * dir); operator DIR *(); + void close(); }; |