libutil: try restoring the cwd from fdSavedCwd

This commit is contained in:
Cole Helbling 2022-04-04 08:33:59 -07:00
parent e135d223f6
commit f89b0f7846

View file

@ -1717,12 +1717,12 @@ void restoreMountNamespace()
try { try {
if (fdSavedMountNamespace && setns(fdSavedMountNamespace.get(), CLONE_NEWNS) == -1) if (fdSavedMountNamespace && setns(fdSavedMountNamespace.get(), CLONE_NEWNS) == -1)
throw SysError("restoring parent mount namespace"); throw SysError("restoring parent mount namespace");
if (fdSavedCwd && fchdir(fdSavedCwd.get()) == -1) {
throw SysError("restoring cwd");
}
} catch (Error & e) { } catch (Error & e) {
debug(e.msg()); debug(e.msg());
} }
if (fdSavedCwd && fchdir(fdSavedCwd.get()) == -1) {
throw SysError("restoring cwd");
}
#endif #endif
} }