aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libutil/util.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index a00a03978..1f800f3f4 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1717,12 +1717,12 @@ void restoreMountNamespace()
try {
if (fdSavedMountNamespace && setns(fdSavedMountNamespace.get(), CLONE_NEWNS) == -1)
throw SysError("restoring parent mount namespace");
+ if (fdSavedCwd && fchdir(fdSavedCwd.get()) == -1) {
+ throw SysError("restoring cwd");
+ }
} catch (Error & e) {
debug(e.msg());
}
- if (fdSavedCwd && fchdir(fdSavedCwd.get()) == -1) {
- throw SysError("restoring cwd");
- }
#endif
}