-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes docker/buildx#2772
- Loading branch information
Showing
4 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build darwin freebsd netbsd openbsd | ||
// +build darwin freebsd netbsd | ||
|
||
package fs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// +build openbsd | ||
|
||
package fs | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
// Returns the last-accessed time | ||
func StatAtime(st *syscall.Stat_t) syscall.Timespec { | ||
return st.Atim | ||
} | ||
|
||
// Returns the last-modified time | ||
func StatMtime(st *syscall.Stat_t) syscall.Timespec { | ||
return st.Mtim | ||
} |