procd: Adding support to detect Pantavisor Container Platform
authorGaurav Pathak <gaurav.pathak@pantacor.com>
Sun, 21 Mar 2021 13:14:33 +0000 (18:44 +0530)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 21 Mar 2021 13:23:25 +0000 (13:23 +0000)
Modified container.h to detect the pantavisor container platform,
as it runs a custom modified version of LXC. container.h is modified
to check if procd is running in a pantavisor container environment by
detecting the presence of pantavisor directory under /.

Signed-off-by: Gaurav Pathak <gaurav.pathak@pantacor.com>
container.h

index 903e3e809627170b852c1f9fe541df3087005018..dede69632dfc7435d0c6430059499e01db3e96f4 100644 (file)
@@ -21,7 +21,8 @@
 static inline bool is_container() {
        struct stat s;
        int r = stat("/.dockerenv", &s);
-       return !!getenv("container") || r == 0;
+       int pv_r = stat("/pantavisor", &s);
+       return !!getenv("container") || r == 0 || pv_r == 0;
 }
 
 #endif