From 3cf771e367075cfbf92e9fb0c03bd0c4220b67a8 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Thu, 28 Jan 2016 19:37:03 +0000 Subject: [PATCH] [cfi] Get rid of a fixed size buffer for the library path in test. llvm-svn: 259082 --- compiler-rt/test/cfi/cross-dso/dlopen.cpp | 7 ++++--- 1 file 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 4cd2f3e97edb..ee4dae2b5f7d 100644 --- a/compiler-rt/test/cfi/cross-dso/dlopen.cpp +++ b/compiler-rt/test/cfi/cross-dso/dlopen.cpp @@ -47,6 +47,8 @@ #include #include +#include + 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);