From f4263f449ac936ca474e75e090fd57fbf1157e56 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sun, 22 Nov 2020 14:45:26 +0100 Subject: [PATCH] Got SIGBUS with std::array; give std::vector a try. --- src/smpi/internals/smpi_global.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index a80f69de38..ba46a4b432 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -378,13 +378,12 @@ static void smpi_copy_file(const std::string& src, const std::string& target, of } #endif // If this point is reached, sendfile() actually is not available. Copy file by hand. - constexpr int BUFSIZE = 1024 * 1024 * 4; - std::array buf; - while (int got = read(fdin, buf.data(), BUFSIZE)) { + std::vector buf(1024 * 1024 * 4); + while (int got = read(fdin, buf.data(), buf.size())) { if (got == -1) { xbt_assert(errno == EINTR, "Cannot read from %s", src.c_str()); } else { - const char* p = buf.data(); + const unsigned char* p = buf.data(); int todo = got; while (int done = write(fdout, p, todo)) { if (done == -1) { -- 2.20.1