diff options
| author | Petr Štetiar | 2019-05-30 05:53:26 +0000 |
|---|---|---|
| committer | Petr Štetiar | 2019-05-30 05:53:26 +0000 |
| commit | ade00ca585a49c8478bf60eb24ce385676be37a4 (patch) | |
| tree | 50f9886adf19e7bbd0f48ca46d646c375a1e3e16 | |
| parent | 385b904b2f0a50030aaa33417a03f45babf4bd3d (diff) | |
| download | procd-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.h | 3 |
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 |