#include <fcntl.h>
#include <sys/ioctl.h>
+#include <sys/mount.h>
#include "fd-util.h"
#include "missing_fs.h"
return r == CLONE_NEWNET;
}
+
+int detach_mount_namespace(void) {
+
+ /* Detaches the mount namespace, disabling propagation from our namespace to the host */
+
+ if (unshare(CLONE_NEWNS) < 0)
+ return -errno;
+
+ if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) < 0)
+ return -errno;
+
+ return 0;
+}