mirror of
https://github.com/docker/cli.git
synced 2026-08-28 10:05:17 -05:00
full diff: https://github.com/moby/go-archive/compare/v0.2.0...2ff9bfb8b2ee Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
25 lines
668 B
Go
25 lines
668 B
Go
//go:build !darwin && !freebsd && !windows
|
|
|
|
package archive
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func mknod(path string, mode uint32, dev uint64) error {
|
|
return unix.Mknod(path, mode, int(dev)) // #nosec G115 -- Required conversion for the platform-specific Mknod API.
|
|
}
|
|
|
|
func mknodInRoot(root *os.Root, path string, mode uint32, dev uint64) error {
|
|
parent, err := root.OpenFile(filepath.Dir(path), os.O_RDONLY|unix.O_DIRECTORY, 0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer parent.Close()
|
|
|
|
return unix.Mknodat(int(parent.Fd()), filepath.Base(path), mode, int(dev)) // #nosec G115 -- Required conversion for the platform-specific Mknod API.
|
|
}
|