Files
Reims-Go/internal/guesttools/rootfs_other.go
T

43 lines
741 B
Go

//go:build !windows
package guesttools
import (
"os"
"path/filepath"
)
func canonicalExistingPath(name string) (string, error) {
return filepath.EvalSymlinks(name)
}
func checkSharedRootPath(root *os.Root, canonical string) error {
resolved, err := filepath.EvalSymlinks(root.Name())
if err != nil {
return err
}
if resolved != canonical {
return os.ErrPermission
}
expected, err := os.Lstat(canonical)
if err != nil {
return err
}
opened, err := root.Stat(".")
if err != nil {
return err
}
if !os.SameFile(opened, expected) {
return os.ErrPermission
}
return nil
}
func checkIrregularEntry(*os.Root, string) error {
return nil
}
func isSharedRegularFile(mode os.FileMode) bool {
return mode.IsRegular()
}