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; + } } }