Unverified Commit c1255030 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

check dlopen errors

In case the glibc could not be loaded through dlopen print the relative
error and exit from the client
parent 2db000c8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -66,6 +66,11 @@ void* libc_dup3;

void init_passthrough_() {
    libc = dlopen("libc.so.6", RTLD_LAZY);
    if(libc == nullptr){
        std::cerr << "ERROR: failed opening glibc shared object: " << dlerror() << std::endl;
        exit(EXIT_FAILURE);
    }

    libc_open = dlsym(libc, "open");
//    libc_fopen = dlsym(libc, "fopen");
//    libc_fopen64 = dlsym(libc, "fopen64");