aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r--src/libutil/util.hh15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index d42099781..679c3a1b6 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -180,18 +180,15 @@ public:
};
-class AutoCloseDir
+struct DIRDeleter
{
- DIR * dir;
-public:
- AutoCloseDir();
- AutoCloseDir(DIR * dir);
- ~AutoCloseDir();
- void operator =(DIR * dir);
- operator DIR *();
- void close();
+ void operator()(DIR * dir) const {
+ closedir(dir);
+ }
};
+typedef std::unique_ptr<DIR, DIRDeleter> AutoCloseDir;
+
class Pid
{