X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6c7b494f8d1203fb34e01e349b339a70a68daa7a..05abbd149db422fcdedc5ed8ef2a928b7d068f23:/src/xbt/xbt_os_file.cpp diff --git a/src/xbt/xbt_os_file.cpp b/src/xbt/xbt_os_file.cpp index 713009edb6..f3d232d726 100644 --- a/src/xbt/xbt_os_file.cpp +++ b/src/xbt/xbt_os_file.cpp @@ -1,6 +1,6 @@ /* xbt_os_file.cpp -- portable interface to file-related functions */ -/* Copyright (c) 2017-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -14,20 +14,21 @@ #endif #if HAVE_UNISTD_H +#include +#include #include #endif #include -#include #include /* POSIX dirname */ simgrid::xbt::Path::Path() { #if HAVE_UNISTD_H - char buffer[2048]; - const char* ret = getcwd(buffer, 2048); - xbt_assert(ret == buffer, "Error during getcwd: %s", strerror(errno)); - path_ = std::string(buffer); + std::array buffer; + const char* cwd = getcwd(buffer.data(), 2048); + xbt_assert(cwd != nullptr, "Error during getcwd: %s", strerror(errno)); + path_ = std::string(cwd); #else path_ = std::string("."); #endif