From 08a97b892862b6e02c82fdd4c2f77b40479fa62d Mon Sep 17 00:00:00 2001 From: Martin Krulis Date: Tue, 5 Jan 2021 22:05:58 +0100 Subject: [PATCH] Final polishing. --- src/helpers/filesystem.cpp | 8 ++++---- src/sandbox/isolate_sandbox.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/helpers/filesystem.cpp b/src/helpers/filesystem.cpp index e33d2014..112613e9 100644 --- a/src/helpers/filesystem.cpp +++ b/src/helpers/filesystem.cpp @@ -9,7 +9,7 @@ * @param dest output arg which is filled in case of success * @return true if the hardlink match is found */ -bool find_matching_hadlink(std::map &hardlinks, const fs::path &src, fs::path &dest) +bool find_matching_hardlink(std::map &hardlinks, const fs::path &src, fs::path &dest) { for (auto& [s, d] : hardlinks) { if (fs::equivalent(s, src)) { // both paths point to the same data on the disk (same hardlinks) @@ -59,7 +59,7 @@ void copy_diretory_internal(const fs::path &src, const fs::path &dest, bool skip // a file may be either copied or hardlinked if (!fs::is_symlink(srcPath) && fs::hard_link_count(srcPath) > 1) { fs::path destPathHardlink; - if (find_matching_hadlink(hardlinks, it->path(), destPathHardlink)) { + if (find_matching_hardlink(hardlinks, it->path(), destPathHardlink)) { // another file refering to the same data already exists in dest directory fs::create_hard_link(destPathHardlink, destPath); continue; // move to next file, hardlink replaced copying @@ -84,9 +84,9 @@ void helpers::copy_directory(const fs::path &src, const fs::path &dest, bool ski { /* * Hardlinks map provide mapping between files in src and dest which have been harlinked. - * Everytime a file with > 1 hadlink count is copied from src to dest, it is registered here. + * Everytime a file with > 1 hardlink count is copied from src to dest, it is registered here. * When files with > 1 hardlinks are encountered, this map is searched and if match is found - * the new file is hadlinked inside dest instead of coping it from src. + * the new file is hardlinked inside dest instead of coping it from src. */ std::map hardlinks; ::copy_diretory_internal(src, dest, skip_symlinks, hardlinks); diff --git a/src/sandbox/isolate_sandbox.cpp b/src/sandbox/isolate_sandbox.cpp index 692850fa..49897171 100644 --- a/src/sandbox/isolate_sandbox.cpp +++ b/src/sandbox/isolate_sandbox.cpp @@ -160,18 +160,18 @@ void isolate_sandbox::isolate_init_child(int fd_0, int fd_1) if (devnull == -1) { log_and_throw(logger_, "Cannot open /dev/null file for writing."); } dup2(devnull, 2); - std::string boxIdArg("--box-id=" + std::to_string(id_)); + std::string box_id_arg("--box-id=" + std::to_string(id_)); // disk quotas need to be set in initialization auto disk_size_blocks = (limits_.disk_size * 1024) / BLOCK_SIZE; - std::string quotaArg("--quota=" + std::to_string(disk_size_blocks) + "," + std::to_string(limits_.disk_files)); + std::string quota_arg("--quota=" + std::to_string(disk_size_blocks) + "," + std::to_string(limits_.disk_files)); // Exec isolate init command const char *args[] { isolate_binary_.c_str(), "--cg", - boxIdArg.c_str(), - quotaArg.c_str(), + box_id_arg.c_str(), + quota_arg.c_str(), "--init", nullptr, };