diff options
author | Paul Spooren <mail@aparcar.org> | 2019-05-27 11:33:29 +0200 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2019-05-29 14:00:32 +0200 |
commit | 7f0f6b2a73f87c31cefc488316e387ed31838ed8 (patch) | |
tree | 592fdaeed18f513f8439c58919f6f2e001ae8910 | |
parent | 1361b970dddb976e667ca58de8659bb8e5fc5d51 (diff) | |
download | procd-7f0f6b2a73f87c31cefc488316e387ed31838ed8.tar.gz |
procd: add docker support
detects if running in a docker container, which then requires special
treatment of mounts. OpenWrt within Docker is useful for CI testing.
Signed-off-by: Paul Spooren <mail@aparcar.org>
-rw-r--r-- | container.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/container.h b/container.h index d33fa32..dd2e432 100644 --- a/container.h +++ b/container.h @@ -16,9 +16,11 @@ #include <stdlib.h> #include <stdbool.h> +#include <sys/stat.h> static inline bool is_container() { - return !!getenv("container"); + struct stat s; + return !!getenv("container") || !!stat("/.dockerenv", &s); } #endif |