treewide: replace local mkdir_p implementations
[project/procd.git] / container.h
index d33fa3266dc09e627ace4f8397796ad018d853b2..903e3e809627170b852c1f9fe541df3087005018 100644 (file)
 
 #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);
+       return !!getenv("container") || r == 0;
 }
 
 #endif