aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2022-04-04 08:33:59 -0700
committerCole Helbling <cole.e.helbling@outlook.com>2022-04-04 08:33:59 -0700
commitf89b0f7846f2177b65eebdbff7f24a255d66819e (patch)
tree3dd1935f0b9290d168530f42948e37f918d8812a /src/libutil/util.cc
parente135d223f66f77f2b03a11b979d714e582364013 (diff)
libutil: `try` restoring the cwd from fdSavedCwd
Diffstat (limited to 'src/libutil/util.cc')
-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
}