aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 822c87a05..f978856a9 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -7,6 +7,7 @@
#include <iostream>
#include <cerrno>
#include <cstdio>
+#include <cstdlib>
#include <sstream>
#include <cstring>
@@ -529,13 +530,14 @@ AutoDelete::AutoDelete(const string & p, bool recursive) : path(p)
AutoDelete::~AutoDelete()
{
try {
- if (del)
+ if (del) {
if (recursive)
deletePath(path);
else {
if (remove(path.c_str()) == -1)
throw SysError(format("cannot unlink `%1%'") % path);
}
+ }
} catch (...) {
ignoreException();
}