From ade00ca585a49c8478bf60eb24ce385676be37a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Thu, 30 May 2019 07:53:26 +0200 Subject: [PATCH] container: fix .dockerenv stat check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit applied check wasn't evaluating the existence of the file properly. Fixes: 7f0f6b2a73f8 ("procd: add docker support") Signed-off-by: Petr Å tetiar --- container.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/container.h b/container.h index dd2e432..903e3e8 100644 --- a/container.h +++ b/container.h @@ -20,7 +20,8 @@ static inline bool is_container() { struct stat s; - return !!getenv("container") || !!stat("/.dockerenv", &s); + int r = stat("/.dockerenv", &s); + return !!getenv("container") || r == 0; } #endif -- 2.30.2