mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-17 00:47:10 +08:00
vendor: github.com/tonistiigi/fsutil 8d32dbdd27d3
full diff: 397af5306b...8d32dbdd27
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
38
vendor/github.com/tonistiigi/fsutil/copy/copy_openbsd.go
generated
vendored
Normal file
38
vendor/github.com/tonistiigi/fsutil/copy/copy_openbsd.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
//go:build openbsd
|
||||
// +build openbsd
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func copyFile(source, target string) error {
|
||||
src, err := os.Open(source)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to open source %s", source)
|
||||
}
|
||||
defer src.Close()
|
||||
tgt, err := os.Create(target)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to open target %s", target)
|
||||
}
|
||||
defer tgt.Close()
|
||||
|
||||
return copyFileContent(tgt, src)
|
||||
}
|
||||
|
||||
func copyFileContent(dst, src *os.File) error {
|
||||
buf := bufferPool.Get().(*[]byte)
|
||||
_, err := io.CopyBuffer(dst, src, *buf)
|
||||
bufferPool.Put(buf)
|
||||
return err
|
||||
}
|
||||
|
||||
func mknod(dst string, mode uint32, rDev int) error {
|
||||
return unix.Mknod(dst, uint32(mode), rDev)
|
||||
}
|
Reference in New Issue
Block a user