From 950b9d175a7966b91adf53b74745ce4e6e5da5f9 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 19 Sep 2018 14:15:50 +0200 Subject: [PATCH] Target_libs may be multiple. --- src/smpi/internals/smpi_global.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 4e218d11e4..2169f674a0 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -569,7 +569,7 @@ static void smpi_init_privatization_dlopen(std::string executable) smpi_copy_file(executable, target_executable, fdin_size); // if smpi/privatize-libs is set, duplicate pointed lib and link each executable copy to a different one. - std::string target_lib; + std::vector target_libs; for (auto const& libpath : privatize_libs_paths) { // if we were given a full path, strip it size_t index = libpath.find_last_of("/\\"); @@ -588,8 +588,9 @@ static void smpi_init_privatization_dlopen(std::string executable) unsigned int pad = 7; if (libname.length() < pad) pad = libname.length(); - target_lib = + std::string target_lib = std::string(pad - std::to_string(rank).length(), '0') + std::to_string(rank) + libname.substr(pad); + target_libs.push_back(target_lib); XBT_DEBUG("copy lib %s to %s, with size %lld", libpath.c_str(), target_lib.c_str(), (long long)fdin_size2); smpi_copy_file(libpath, target_lib, fdin_size2); @@ -606,7 +607,7 @@ static void smpi_init_privatization_dlopen(std::string executable) int saved_errno = errno; if (simgrid::config::get_value("smpi/keep-temps") == false) { unlink(target_executable.c_str()); - if (not target_lib.empty()) + for (const std::string& target_lib : target_libs) unlink(target_lib.c_str()); } if (handle == nullptr) -- 2.20.1