chiark / gitweb /
nspawn: support ephemeral boots from images
[elogind.git] / src / basic / virt.c
index 7a2b9e9bd607b81f584818e8f53ffbe30e220404..c935c534bb99863695fdf8b3cec3ad4927bfa383 100644 (file)
@@ -486,7 +486,6 @@ int detect_virtualization(void) {
 
         return r;
 }
-#endif // 0
 
 static int userns_has_mapping(const char *name) {
         _cleanup_fclose_ FILE *f = NULL;
@@ -499,7 +498,7 @@ static int userns_has_mapping(const char *name) {
         f = fopen(name, "re");
         if (!f) {
                 log_debug_errno(errno, "Failed to open %s: %m", name);
-                return errno == -ENOENT ? false : -errno;
+                return errno == ENOENT ? false : -errno;
         }
 
         n = getline(&buf, &n_allocated, f);
@@ -557,12 +556,15 @@ int running_in_userns(void) {
         log_debug("/proc/self/setgroups contains \"%s\", %s user namespace", line, r ? "in" : "not in");
         return r;
 }
+#endif // 0
 
 int running_in_chroot(void) {
         int ret;
 
+#if 0 /// elogind does not allow to ignore chroots, we are never init!
         if (getenv_bool("SYSTEMD_IGNORE_CHROOT") > 0)
                 return 0;
+#endif // 0
 
         ret = files_same("/proc/1/root", "/");
         if (ret < 0)