diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-29 01:46:54 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-29 01:46:54 +0900 |
| commit | eb3385d490523262e26b6cb691a5e18a07a8b26d (patch) | |
| tree | ed8e9e95f81b4962ebf23d206e963b016975f6c9 /container/mount.go | |
| parent | b8669338da36c9a4fabec6c49cad20a5f8180cf2 (diff) | |
container/initsymlink: unwrap mount errors
The mount function now wraps its own errors in a much more descriptive type with proper message formatting. Wrapping them no longer makes any sense.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/mount.go')
| -rw-r--r-- | container/mount.go | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/container/mount.go b/container/mount.go index f7d4af31..fc510b40 100644 --- a/container/mount.go +++ b/container/mount.go @@ -106,8 +106,7 @@ func (p *procPaths) bindMount(source, target string, flags uintptr, eq bool) err } if err := p.k.mount(source, target, FstypeNULL, MS_SILENT|MS_BIND|flags&MS_REC, zeroString); err != nil { - return wrapErrSuffix(err, - fmt.Sprintf("cannot mount %q on %q:", source, target)) + return err } return p.k.remount(target, flags) @@ -161,8 +160,7 @@ func (p *procPaths) remount(target string, flags uintptr) error { } if err = remountWithFlags(p.k, n, mf); err != nil { - return wrapErrSuffix(err, - fmt.Sprintf("cannot remount %q:", n.Clean)) + return err } if flags&MS_REC == 0 { return nil @@ -174,11 +172,8 @@ func (p *procPaths) remount(target string, flags uintptr) error { continue } - err = remountWithFlags(p.k, cur, mf) - - if err != nil && !errors.Is(err, EACCES) { - return wrapErrSuffix(err, - fmt.Sprintf("cannot propagate flags to %q:", cur.Clean)) + if err = remountWithFlags(p.k, cur, mf); err != nil && !errors.Is(err, EACCES) { + return err } } @@ -213,9 +208,7 @@ func mountTmpfs(k syscallDispatcher, fsname, target string, flags uintptr, size if size > 0 { opt += fmt.Sprintf(",size=%d", size) } - return wrapErrSuffix( - k.mount(fsname, target, FstypeTmpfs, flags, opt), - fmt.Sprintf("cannot mount tmpfs on %q:", target)) + return k.mount(fsname, target, FstypeTmpfs, flags, opt) } func parentPerm(perm os.FileMode) os.FileMode { |
