utils: make sure read() string is 0 terminated
[project/procd.git] / container.h
index dd2e432adbfc586fd824846d63485b42248fe8a9..dede69632dfc7435d0c6430059499e01db3e96f4 100644 (file)
@@ -20,7 +20,9 @@
 
 static inline bool is_container() {
        struct stat s;
-       return !!getenv("container") || !!stat("/.dockerenv", &s);
+       int r = stat("/.dockerenv", &s);
+       int pv_r = stat("/pantavisor", &s);
+       return !!getenv("container") || r == 0 || pv_r == 0;
 }
 
 #endif