aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-18 12:08:08 -0500
committerGitHub <noreply@github.com>2022-01-18 12:08:08 -0500
commit094665ac0cccc04c7797881ff2a27ff330e9a72e (patch)
tree5e858d21a6d9ad22049bb8188fa71727be14e523 /vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go
parent0bbf8fa14035371cdc5bb04f5db51da8a8f94d48 (diff)
parent774271c38a8c3e96c7518b3c03de2f00e87138be (diff)
downloadpodman-094665ac0cccc04c7797881ff2a27ff330e9a72e.tar.gz
podman-094665ac0cccc04c7797881ff2a27ff330e9a72e.tar.bz2
podman-094665ac0cccc04c7797881ff2a27ff330e9a72e.zip
Merge pull request #12894 from Luap99/deps
upgrade all dependencies
Diffstat (limited to 'vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go')
-rw-r--r--vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go
index 6b9fc3435..cd78f23e1 100644
--- a/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go
+++ b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go
@@ -11,7 +11,7 @@ import (
"strings"
"unsafe"
- securejoin "github.com/cyphar/filepath-securejoin"
+ "github.com/cyphar/filepath-securejoin"
"golang.org/x/sys/unix"
)
@@ -33,6 +33,16 @@ func init() {
}
}
+// ResolveRootfs ensures that the current working directory is
+// not a symlink and returns the absolute path to the rootfs
+func ResolveRootfs(uncleanRootfs string) (string, error) {
+ rootfs, err := filepath.Abs(uncleanRootfs)
+ if err != nil {
+ return "", err
+ }
+ return filepath.EvalSymlinks(rootfs)
+}
+
// ExitStatus returns the correct exit status for a process based on if it
// was signaled or exited cleanly
func ExitStatus(status unix.WaitStatus) int {
@@ -110,7 +120,7 @@ func WithProcfd(root, unsafePath string, fn func(procfd string) error) error {
unsafePath = stripRoot(root, unsafePath)
path, err := securejoin.SecureJoin(root, unsafePath)
if err != nil {
- return fmt.Errorf("resolving path inside rootfs failed: %w", err)
+ return fmt.Errorf("resolving path inside rootfs failed: %v", err)
}
// Open the target path.