diff --git a/src/OSspecific/MSwindows/MSwindows.C b/src/OSspecific/MSwindows/MSwindows.C index 8769e3d326..10bc5a59cf 100644 --- a/src/OSspecific/MSwindows/MSwindows.C +++ b/src/OSspecific/MSwindows/MSwindows.C @@ -7,7 +7,7 @@ ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011 Symscape - Copyright (C) 2016-2022 OpenCFD Ltd. + Copyright (C) 2016-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -998,14 +998,14 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) if (exists(src, false)) { constexpr const int maxIndex = 99; - char index[3]; + char index[4]; for (int n = 0; n <= maxIndex; ++n) { fileName dstName(src + "." + ext); if (n) { - sprintf(index, "%02d", n); + ::snprintf(index, 4, "%02d", n); dstName += index; } diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index adc6e544de..826ac47021 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2022 OpenCFD Ltd. + Copyright (C) 2016-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1305,14 +1305,14 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) if (exists(src, false)) { constexpr const int maxIndex = 99; - char index[3]; + char index[4]; for (int n = 0; n <= maxIndex; ++n) { fileName dstName(src + "." + ext); if (n) { - ::sprintf(index, "%02d", n); + ::snprintf(index, 4, "%02d", n); dstName += index; } @@ -1639,6 +1639,7 @@ int Foam::system(const std::string& command, const bool bg) return 0; } + // TBD: vfork is deprecated as of macOS 12.0 const pid_t child_pid = ::vfork(); // NB: vfork, not fork! if (child_pid == -1) @@ -1698,6 +1699,7 @@ int Foam::system(const CStringList& command, const bool bg) // The normal system() command has a fork buried in it that causes // issues with infiniband and openmpi etc. + // TBD: vfork is deprecated as of macOS 12.0 const pid_t child_pid = ::vfork(); if (child_pid == -1) diff --git a/src/fileFormats/stl/STLCore.C b/src/fileFormats/stl/STLCore.C index c51b4edbee..69749a70ff 100644 --- a/src/fileFormats/stl/STLCore.C +++ b/src/fileFormats/stl/STLCore.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2022 OpenCFD Ltd. + Copyright (C) 2016-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -234,7 +234,7 @@ void Foam::fileFormats::STLCore::writeBinaryHeader { // STL header with extra information about nTris char header[STLHeaderSize]; - sprintf(header, "STL binary file %u facets", nTris); + ::snprintf(header, STLHeaderSize, "STL binary file %u facets", nTris); // Fill trailing with zeroes (to avoid writing junk) for (size_t i = strlen(header); i < STLHeaderSize; ++i)