]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/archive/tar/stat_unix.go
archive/tar: add FileInfoNames interface
[gostls13.git] / src / archive / tar / stat_unix.go
index 0f3428bc24b47d3683ace47bd38bd0548f7d5dd7..5b23d3c8302f488cee4f504183fc20b32a1bc10a 100644 (file)
@@ -17,6 +17,7 @@ import (
 
 func init() {
        sysStat = statUnix
+       loadUidAndGid = loadUidAndGidFunc
 }
 
 // userMap and groupMap caches UID and GID lookups for performance reasons.
@@ -99,3 +100,12 @@ func statUnix(fi fs.FileInfo, h *Header) error {
        }
        return nil
 }
+
+func loadUidAndGidFunc(fi fs.FileInfo, uid, gid *int) {
+       sys, ok := fi.Sys().(*syscall.Stat_t)
+       if !ok {
+               return
+       }
+       *uid = int(sys.Uid)
+       *gid = int(sys.Gid)
+}