diff options
Diffstat (limited to 'compiler-rt/test/cfi/cross-dso/dlopen.cpp')
-rw-r--r-- | compiler-rt/test/cfi/cross-dso/dlopen.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler-rt/test/cfi/cross-dso/dlopen.cpp b/compiler-rt/test/cfi/cross-dso/dlopen.cpp index 4cd2f3e97ed..ee4dae2b5f7 100644 --- a/compiler-rt/test/cfi/cross-dso/dlopen.cpp +++ b/compiler-rt/test/cfi/cross-dso/dlopen.cpp @@ -47,6 +47,8 @@ #include <string.h> #include <sys/mman.h> +#include <string> + struct A { virtual void f(); }; @@ -91,9 +93,8 @@ int main(int argc, char *argv[]) { const bool test_cast = argc > 1 && strcmp(argv[1], "cast") == 0; const bool test_dlclose = argc > 1 && strcmp(argv[1], "dlclose") == 0; - char name[100]; - snprintf(name, sizeof(name), "%s-so.so", argv[0]); - void *handle = dlopen(name, RTLD_NOW); + std::string name = std::string(argv[0]) + "-so.so"; + void *handle = dlopen(name.c_str(), RTLD_NOW); assert(handle); void *(*create_B)() = (void *(*)())dlsym(handle, "create_B"); assert(create_B); |