From fc26659ea11fea8f41fc2551d6d39d30fe3a49e7 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 27 Dec 2024 18:57:44 +0900 Subject: [PATCH] fst/config: autoetc read custom path Signed-off-by: Ophestra --- fst/config.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fst/config.go b/fst/config.go index 73809a8..19e1766 100644 --- a/fst/config.go +++ b/fst/config.go @@ -153,14 +153,14 @@ func (s *SandboxConfig) Bwrap(os linux.System) (*bwrap.Config, error) { } if s.AutoEtc { - if s.Etc == "" { - conf.Bind("/etc", Tmp+"/etc") - } else { - conf.Bind(s.Etc, Tmp+"/etc") + etc := s.Etc + if etc == "" { + etc = "/etc" } + conf.Bind(etc, Tmp+"/etc") // link host /etc contents to prevent passwd/group from being overwritten - if d, err := os.ReadDir("/etc"); err != nil { + if d, err := os.ReadDir(etc); err != nil { return nil, err } else { for _, ent := range d {