mirror of
https://github.com/golang/go
synced 2024-11-19 20:34:42 -07:00
archive/tar: populate Devmajor and Devminor in FileInfoHeader on Darwin
Extract device major/minor number on Darwin and set Devmajor and Devminor in FileInfoHeader. Code based on the Major/Minor functions for Darwin in golang.org/x/sys/unix. Change-Id: I51b65f607bfa2e6b177b8b66e2b246b771367b84 Reviewed-on: https://go-review.googlesource.com/60850 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
cecba84a0d
commit
ec359643a1
@ -61,6 +61,11 @@ func statUnix(fi os.FileInfo, h *Header) error {
|
|||||||
minor := uint32((dev & 0x00000000000000ff) >> 0)
|
minor := uint32((dev & 0x00000000000000ff) >> 0)
|
||||||
minor |= uint32((dev & 0x00000ffffff00000) >> 12)
|
minor |= uint32((dev & 0x00000ffffff00000) >> 12)
|
||||||
h.Devmajor, h.Devminor = int64(major), int64(minor)
|
h.Devmajor, h.Devminor = int64(major), int64(minor)
|
||||||
|
case "darwin":
|
||||||
|
// Copied from golang.org/x/sys/unix/dev_darwin.go.
|
||||||
|
major := uint32((dev >> 24) & 0xff)
|
||||||
|
minor := uint32(dev & 0xffffff)
|
||||||
|
h.Devmajor, h.Devminor = int64(major), int64(minor)
|
||||||
default:
|
default:
|
||||||
// TODO: Implement others (see https://golang.org/issue/8106)
|
// TODO: Implement others (see https://golang.org/issue/8106)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user