diff options
| author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-01-28 19:37:03 +0000 |
|---|---|---|
| committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-01-28 19:37:03 +0000 |
| commit | 3cf771e367075cfbf92e9fb0c03bd0c4220b67a8 (patch) | |
| tree | a45dff9ab13703d4d6db553fa85fa6f2d5b3d709 | |
| parent | 7b837f578a8334dfdd0610419850a5594022754b (diff) | |
| download | bcm5719-llvm-3cf771e367075cfbf92e9fb0c03bd0c4220b67a8.tar.gz bcm5719-llvm-3cf771e367075cfbf92e9fb0c03bd0c4220b67a8.zip | |
[cfi] Get rid of a fixed size buffer for the library path in test.
llvm-svn: 259082
| -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); |

