Loading ifs/include/preload/passthrough.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ extern void* libc_dup2; extern void* libc_dup3; extern void* libc_opendir; extern void* libc_fdopendir; extern void* libc_readdir; extern void* libc_closedir; Loading ifs/src/preload/intcp_functions.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -836,6 +836,24 @@ DIR* opendir(const char* path){ return (reinterpret_cast<decltype(&opendir)>(libc_opendir))(path); } DIR* fdopendir(int fd){ init_passthrough_if_needed(); if(CTX->initialized()) { CTX->log()->trace("{}() called with fd {}", __func__, fd); if (CTX->file_map()->exist(fd)) { auto open_file = CTX->file_map()->get(fd); auto open_dir = static_pointer_cast<OpenDir>(open_file); if(!open_dir){ //Cast did not succeeded: open_file is a regular file errno = EBADF; return nullptr; } return fd_to_dirp(fd); } } return (reinterpret_cast<decltype(&fdopendir)>(libc_fdopendir))(fd); } struct dirent* intcp_readdir(DIR* dirp){ init_passthrough_if_needed(); if(CTX->initialized()) { Loading ifs/src/preload/passthrough.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ void* libc_dup2; void* libc_dup3; void* libc_opendir; void* libc_fdopendir; void* libc_readdir; void* libc_closedir; Loading Loading @@ -159,6 +160,7 @@ void init_passthrough_() { libc_dup3 = dlsym(libc, "dup3"); libc_opendir = dlsym(libc, "opendir"); libc_fdopendir = dlsym(libc, "fdopendir"); libc_readdir = dlsym(libc, "readdir"); libc_closedir = dlsym(libc, "closedir"); Loading Loading
ifs/include/preload/passthrough.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ extern void* libc_dup2; extern void* libc_dup3; extern void* libc_opendir; extern void* libc_fdopendir; extern void* libc_readdir; extern void* libc_closedir; Loading
ifs/src/preload/intcp_functions.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -836,6 +836,24 @@ DIR* opendir(const char* path){ return (reinterpret_cast<decltype(&opendir)>(libc_opendir))(path); } DIR* fdopendir(int fd){ init_passthrough_if_needed(); if(CTX->initialized()) { CTX->log()->trace("{}() called with fd {}", __func__, fd); if (CTX->file_map()->exist(fd)) { auto open_file = CTX->file_map()->get(fd); auto open_dir = static_pointer_cast<OpenDir>(open_file); if(!open_dir){ //Cast did not succeeded: open_file is a regular file errno = EBADF; return nullptr; } return fd_to_dirp(fd); } } return (reinterpret_cast<decltype(&fdopendir)>(libc_fdopendir))(fd); } struct dirent* intcp_readdir(DIR* dirp){ init_passthrough_if_needed(); if(CTX->initialized()) { Loading
ifs/src/preload/passthrough.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ void* libc_dup2; void* libc_dup3; void* libc_opendir; void* libc_fdopendir; void* libc_readdir; void* libc_closedir; Loading Loading @@ -159,6 +160,7 @@ void init_passthrough_() { libc_dup3 = dlsym(libc, "dup3"); libc_opendir = dlsym(libc, "opendir"); libc_fdopendir = dlsym(libc, "fdopendir"); libc_readdir = dlsym(libc, "readdir"); libc_closedir = dlsym(libc, "closedir"); Loading