mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +08:00
Fixes isRootfull check using qemu machine on Windows
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
//go:build !darwin && !windows
|
//go:build !darwin
|
||||||
// +build !darwin,!windows
|
// +build !darwin
|
||||||
|
|
||||||
package qemu
|
package qemu
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
//go:build (amd64 && !windows) || (arm64 && !windows)
|
|
||||||
// +build amd64,!windows arm64,!windows
|
|
||||||
|
|
||||||
package qemu
|
package qemu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -870,7 +870,7 @@ func NewQMPMonitor(network, name string, timeout time.Duration) (Monitor, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return Monitor{}, err
|
return Monitor{}, err
|
||||||
}
|
}
|
||||||
if !rootless.IsRootless() {
|
if isRootful() {
|
||||||
rtDir = "/run"
|
rtDir = "/run"
|
||||||
}
|
}
|
||||||
rtDir = filepath.Join(rtDir, "podman")
|
rtDir = filepath.Join(rtDir, "podman")
|
||||||
@ -1371,7 +1371,7 @@ func (v *MachineVM) setPIDSocket() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !rootless.IsRootless() {
|
if isRootful() {
|
||||||
rtPath = "/run"
|
rtPath = "/run"
|
||||||
}
|
}
|
||||||
socketDir := filepath.Join(rtPath, "podman")
|
socketDir := filepath.Join(rtPath, "podman")
|
||||||
@ -1397,7 +1397,7 @@ func (v *MachineVM) getSocketandPid() (string, string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
if !rootless.IsRootless() {
|
if isRootful() {
|
||||||
rtPath = "/run"
|
rtPath = "/run"
|
||||||
}
|
}
|
||||||
socketDir := filepath.Join(rtPath, "podman")
|
socketDir := filepath.Join(rtPath, "podman")
|
||||||
@ -1735,3 +1735,11 @@ func isProcessAlive(pid int) bool {
|
|||||||
func (p *Provider) VMType() string {
|
func (p *Provider) VMType() string {
|
||||||
return vmtype
|
return vmtype
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isRootful() bool {
|
||||||
|
// Rootless is not relevant on Windows. In the future rootless.IsRootless
|
||||||
|
// could be switched to return true on Windows, and other codepaths migrated
|
||||||
|
// for now will check additionally for valid os.Getuid
|
||||||
|
|
||||||
|
return !rootless.IsRootless() && os.Getuid() != -1
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user