summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Štetiar2019-05-30 05:53:26 +0000
committerPetr Štetiar2019-05-30 05:53:26 +0000
commitade00ca585a49c8478bf60eb24ce385676be37a4 (patch)
tree50f9886adf19e7bbd0f48ca46d646c375a1e3e16
parent385b904b2f0a50030aaa33417a03f45babf4bd3d (diff)
downloadprocd-ade00ca585a49c8478bf60eb24ce385676be37a4.tar.gz
container: fix .dockerenv stat check
applied check wasn't evaluating the existence of the file properly. Fixes: 7f0f6b2a73f8 ("procd: add docker support") Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r--container.h3
1 files changed, 2 insertions, 1 deletions
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