#include "Util.hpp"
#include "assertions.hpp"
-#include <UmaskScope.hpp>
#include <core/exceptions.hpp>
#include <core/types.hpp>
#include <core/wincompat.hpp>
#include <fmtmacros.hpp>
#include <util/Tokenizer.hpp>
+#include <util/UmaskScope.hpp>
#include <util/environment.hpp>
#include <util/expected.hpp>
#include <util/file.hpp>
const std::string& key,
const std::string& value) const
{
- UmaskScope umask_scope(m_umask);
+ util::UmaskScope umask_scope(m_umask);
if (k_config_key_table.find(key) == k_config_key_table.end()) {
throw core::Error(FMT("unknown configuration option \"{}\"", key));
-// Copyright (C) 2002-2007 Andrew Tridgell
// Copyright (C) 2009-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2002-2007 Andrew Tridgell
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
#include "MiniTrace.hpp"
#include "SignalHandler.hpp"
#include "TemporaryFile.hpp"
-#include "UmaskScope.hpp"
#include "Util.hpp"
#include "Win32Util.hpp"
#include "argprocessing.hpp"
#include <core/types.hpp>
#include <core/wincompat.hpp>
#include <storage/Storage.hpp>
+#include <util/UmaskScope.hpp>
#include <util/environment.hpp>
#include <util/expected.hpp>
#include <util/file.hpp>
#include <util/path.hpp>
+#include <util/process.hpp>
#include <util/string.hpp>
#include "third_party/fmt/core.h"
static nonstd::expected<DoExecuteResult, Failure>
do_execute(Context& ctx, Args& args, const bool capture_stdout = true)
{
- UmaskScope umask_scope(ctx.original_umask);
+ util::UmaskScope umask_scope(ctx.original_umask);
if (ctx.diagnostics_color_failed) {
DEBUG_ASSERT(ctx.config.compiler_type() == CompilerType::gcc);
cache_entry.verify_checksum();
core::Result::Deserializer deserializer(cache_entry.payload());
core::ResultRetriever result_retriever(ctx, result_key);
- UmaskScope umask_scope(ctx.original_umask);
+ util::UmaskScope umask_scope(ctx.original_umask);
deserializer.visit(result_retriever);
} catch (core::ResultRetriever::WriteError& e) {
LOG("Write error when retrieving result from {}: {}",
#include <ProgressBar.hpp>
#include <TemporaryFile.hpp>
#include <ThreadPool.hpp>
-#include <UmaskScope.hpp>
#include <Util.hpp>
#include <assertions.hpp>
#include <ccache.hpp>
#include <storage/Storage.hpp>
#include <storage/local/LocalStorage.hpp>
#include <util/TextTable.hpp>
+#include <util/UmaskScope.hpp>
#include <util/XXH3_128.hpp>
#include <util/environment.hpp>
#include <util/expected.hpp>
config.read();
Logging::init(config);
- UmaskScope umask_scope(config.umask());
+ util::UmaskScope umask_scope(config.umask());
const std::string arg = optarg ? optarg : std::string();
#include <AtomicFile.hpp>
#include <Logging.hpp>
-#include <UmaskScope.hpp>
#include <Util.hpp>
#include <assertions.hpp>
#include <core/exceptions.hpp>
#include <fmtmacros.hpp>
#include <util/Bytes.hpp>
+#include <util/UmaskScope.hpp>
#include <util/expected.hpp>
#include <util/file.hpp>
#include <util/string.hpp>
}
{
- UmaskScope umask_scope(m_umask);
+ util::UmaskScope umask_scope(m_umask);
const auto dir = Util::dir_name(path);
if (!Util::create_dir(dir)) {
TextTable.cpp
TimePoint.cpp
Tokenizer.cpp
+ UmaskScope.cpp
environment.cpp
file.cpp
path.cpp
-// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2023 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#include "UmaskScope.hpp"
#include <util/process.hpp>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <optional>
+namespace util {
-// This class sets a new (process-global) umask and restores the previous umask
-// when destructed.
-class UmaskScope
-{
-public:
- UmaskScope(std::optional<mode_t> new_umask);
- ~UmaskScope();
-
- void release();
-
-private:
- std::optional<mode_t> m_saved_umask = std::nullopt;
-};
-
-inline UmaskScope::UmaskScope(std::optional<mode_t> new_umask)
+UmaskScope::UmaskScope(std::optional<mode_t> new_umask)
{
#ifndef _WIN32
if (new_umask) {
#endif
}
-inline UmaskScope::~UmaskScope()
-{
- release();
-}
-
-inline void
+void
UmaskScope::release()
{
#ifndef _WIN32
}
#endif
}
+
+} // namespace util
--- /dev/null
+// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
+//
+// See doc/AUTHORS.adoc for a complete list of contributors.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along with
+// this program; if not, write to the Free Software Foundation, Inc., 51
+// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+#pragma once
+
+#include <sys/types.h>
+
+#include <optional>
+
+namespace util {
+
+// This class sets a new (process-global) umask and restores the previous umask
+// when destructed.
+class UmaskScope
+{
+public:
+ UmaskScope(std::optional<mode_t> new_umask);
+ ~UmaskScope();
+
+ void release();
+
+private:
+ std::optional<mode_t> m_saved_umask = std::nullopt;
+};
+
+inline UmaskScope::~UmaskScope()
+{
+ release();
+}
+
+} // namespace util