jail: make sure jailed process is terminated
[project/procd.git] / container.h
index 7fb07683fde9836c24e41ad5c785f24cf85282a9..dede69632dfc7435d0c6430059499e01db3e96f4 100644 (file)
 
 #ifndef __CONTAINER_H
 #define __CONTAINER_H
+
 #include <stdlib.h>
+#include <stdbool.h>
+#include <sys/stat.h>
 
 static inline bool is_container() {
-       return !!getenv("container");
+       struct stat s;
+       int r = stat("/.dockerenv", &s);
+       int pv_r = stat("/pantavisor", &s);
+       return !!getenv("container") || r == 0 || pv_r == 0;
 }
 
 #endif