From f7e471616d8c132be5eb86b269ec90f1d5852f12 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Sat, 9 Dec 2023 00:55:25 +0800 Subject: [PATCH] Fix clone_attr for newly created dirs --- native/src/core/module.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/src/core/module.cpp b/native/src/core/module.cpp index 59310ab01..5279465e2 100644 --- a/native/src/core/module.cpp +++ b/native/src/core/module.cpp @@ -163,7 +163,7 @@ void module_node::mount() { void tmpfs_node::mount() { string src = mirror_path(); - const char *src_path = access(src.data(), F_OK) == 0 ? src.data() : parent()->node_path().data(); + const char *src_path = access(src.data(), F_OK) == 0 ? src.data() : nullptr; if (!isa(parent())) { const string &dest = node_path(); auto worker_dir = worker_path(); @@ -172,12 +172,12 @@ void tmpfs_node::mount() { dir_node::mount(); VLOGD(skip_mirror() ? "replace" : "move", worker_dir.data(), dest.data()); xmount(worker_dir.data(), dest.data(), nullptr, MS_MOVE, nullptr); - clone_attr(src_path, dest.data()); + clone_attr(src_path ?: parent()->node_path().data(), dest.data()); } else { const string dest = worker_path(); // We don't need another layer of tmpfs if parent is tmpfs mkdir(dest.data(), 0); - clone_attr(src_path, dest.data()); + clone_attr(src_path ?: parent()->worker_path().data(), dest.data()); dir_node::mount(); } }