aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/container_linux.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-03 20:46:41 +0900
committerOphestra <cat@gensokyo.uk>2025-08-03 21:16:45 +0900
commitc6be82bcf91fc4b6e61d9df40213e80367addbd8 (patch)
treeee245cf214ff845f0d8a3eac0cc1a6064107112d /internal/app/container_linux.go
parent38245559dca0833dc078b982d59490eee53e168c (diff)
container/path: fhs path constants
This increases readability since this can help disambiguate absolute paths from similarly named path segments. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/container_linux.go')
-rw-r--r--internal/app/container_linux.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/app/container_linux.go b/internal/app/container_linux.go
index a0c81d7a..1ea23d44 100644
--- a/internal/app/container_linux.go
+++ b/internal/app/container_linux.go
@@ -81,13 +81,13 @@ func newContainer(s *hst.ContainerConfig, os sys.State, prefix string, uid, gid
}
params.
- Proc("/proc").
+ Proc(container.FHSProc).
Tmpfs(hst.Tmp, 1<<12, 0755)
if !s.Device {
- params.DevWritable("/dev", true)
+ params.DevWritable(container.FHSDev, true)
} else {
- params.Bind("/dev", "/dev", container.BindWritable|container.BindDevice)
+ params.Bind(container.FHSDev, container.FHSDev, container.BindWritable|container.BindDevice)
}
/* retrieve paths and hide them if they're made available in the sandbox;
@@ -111,7 +111,7 @@ func newContainer(s *hst.ContainerConfig, os sys.State, prefix string, uid, gid
if path.IsAbs(pair[1]) {
// get parent dir of socket
dir := path.Dir(pair[1])
- if dir == "." || dir == "/" {
+ if dir == "." || dir == container.FHSRoot {
os.Printf("dbus socket %q is in an unusual location", pair[1])
}
hidePaths = append(hidePaths, dir)
@@ -229,19 +229,19 @@ func newContainer(s *hst.ContainerConfig, os sys.State, prefix string, uid, gid
if !s.AutoEtc {
if s.Etc != "" {
- params.Bind(s.Etc, "/etc", 0)
+ params.Bind(s.Etc, container.FHSEtc, 0)
}
} else {
etcPath := s.Etc
if etcPath == "" {
- etcPath = "/etc"
+ etcPath = container.FHSEtc
}
params.Etc(etcPath, prefix)
}
// no more ContainerConfig paths beyond this point
if !s.Device {
- params.Remount("/dev", syscall.MS_RDONLY)
+ params.Remount(container.FHSDev, syscall.MS_RDONLY)
}
return params, maps.Clone(s.Env), nil