]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
virt: Use cache for VIRTUALIZATION_PROOT
authorChris Down <chris@chrisdown.name>
Wed, 15 Apr 2020 17:40:14 +0000 (18:40 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Apr 2020 06:55:32 +0000 (08:55 +0200)
Of course, the very moment after I merged #15426, I noticed something
was off: everything works, but the cache isn't updated. 🙈

src/basic/virt.c

index c22bcf9aea7103da49a2535533faac4119e9426b..f21a36c6fea1b1368ccc299c2277e88e94a65998 100644 (file)
@@ -485,8 +485,10 @@ int detect_container(void) {
                         const char *pf = procfs_file_alloca(ptrace_pid, "comm");
                         _cleanup_free_ char *ptrace_comm = NULL;
                         r = read_one_line_file(pf, &ptrace_comm);
-                        if (r >= 0 && startswith(ptrace_comm, "proot"))
-                                return VIRTUALIZATION_PROOT;
+                        if (r >= 0 && startswith(ptrace_comm, "proot")) {
+                                r = VIRTUALIZATION_PROOT;
+                                goto finish;
+                        }
                 }
         }