#include #include #include #include #include bool allow_open = true; int __real_open(const char *path, int flags, ...); int __wrap_open(const char *path, int flags, ...) { if (allow_open) { if (flags & O_CREAT) { va_list vl; va_start(vl, flags); mode_t mode = va_arg(vl, mode_t); va_end(vl); return __real_open(path, flags, mode); } else { return __real_open(path, flags); } } else { return -1; } }