From 9b4f3fa3eacb211c9838dc9e9e85c3eefc53b512 Mon Sep 17 00:00:00 2001 From: Chris Down Date: Wed, 15 Apr 2020 18:40:14 +0100 Subject: [PATCH] virt: Use cache for VIRTUALIZATION_PROOT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/basic/virt.c b/src/basic/virt.c index c22bcf9aea7..f21a36c6fea 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -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; + } } }