Skip to content

Commit d9e1e9c

Browse files
reddevillgdengbo11
authored andcommitted
fix: treat /etc/localtime as fixed mount node
Signed-off-by: reddevillg <[email protected]>
1 parent 1f25cfc commit d9e1e9c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libs/oci-cfg-generators/src/linglong/oci-cfg-generators/container_cfg_builder.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,9 +1770,12 @@ bool ContainerCfgBuilder::shouldFix(int node, std::filesystem::path &fixPath) no
17701770
});
17711771
return find != mount.options->end();
17721772
};
1773-
// if file is not exist or
1774-
// file is not a symlink but mount with option copy-symlink
1775-
if (!std::filesystem::exists(hostPath, ec)
1773+
// node should fix if the file
1774+
// 1. is /etc/localtime or
1775+
// 2. is not exist or
1776+
// 3. is not a symlink but mount with option copy-symlink
1777+
if (getRelativePath(0, node) == "etc/localtime"
1778+
|| !std::filesystem::exists(hostPath, ec)
17761779
|| ((!std::filesystem::is_symlink(hostPath, ec)) && isCopySymlink(node))) {
17771780
fixPath = std::move(hostPath);
17781781
return true;

0 commit comments

Comments
 (0)