X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3344890b7ae11302d717d964e6dd96fe2d10ac6a..67d66b0cf79b9fc02c0450f254584693dbf21d3b:/src/xbt/xbt_os_file.cpp diff --git a/src/xbt/xbt_os_file.cpp b/src/xbt/xbt_os_file.cpp index 4316ee4367..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