mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
rootless: skip usage of filepath.Join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1507 Approved by: rhatdan
This commit is contained in:

committed by
Atomic Bot

parent
6d1eecf7cf
commit
37b2601a81
@ -9,7 +9,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
gosignal "os/signal"
|
gosignal "os/signal"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -252,7 +251,7 @@ func readUserNs(path string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readUserNsFd(fd uintptr) (string, error) {
|
func readUserNsFd(fd uintptr) (string, error) {
|
||||||
return readUserNs(filepath.Join("/proc/self/fd", fmt.Sprintf("%d", fd)))
|
return readUserNs(fmt.Sprintf("/proc/self/fd/%d", fd))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getOwner(fd uintptr) (uintptr, error) {
|
func getOwner(fd uintptr) (uintptr, error) {
|
||||||
@ -288,7 +287,7 @@ func getUserNSForPath(path string) (*os.File, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getUserNSForPid(pid uint) (*os.File, error) {
|
func getUserNSForPid(pid uint) (*os.File, error) {
|
||||||
path := filepath.Join("/proc", fmt.Sprintf("%d", pid), "ns/user")
|
path := fmt.Sprintf("/proc/%d/ns/user", pid)
|
||||||
u, err := os.Open(path)
|
u, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "cannot open %s", path)
|
return nil, errors.Wrapf(err, "cannot open %s", path)
|
||||||
|
Reference in New Issue
Block a user