From: Chris Down Date: Wed, 15 Apr 2020 17:40:14 +0000 (+0100) Subject: virt: Use cache for VIRTUALIZATION_PROOT X-Git-Tag: v246-rc1~583 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b4f3fa3eacb211c9838dc9e9e85c3eefc53b512;p=thirdparty%2Fsystemd.git virt: Use cache for VIRTUALIZATION_PROOT Of course, the very moment after I merged #15426, I noticed something was off: everything works, but the cache isn't updated. 🙈 --- 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; + } } }