-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtarutil.go
More file actions
41 lines (35 loc) · 1.17 KB
/
tarutil.go
File metadata and controls
41 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package tarutil
import (
"syscall"
"time"
"unsafe"
"github.com/pkg/errors"
)
var (
maxTime time.Time
errSyscallNotImplemented = errors.New("syscall not implemented")
errFailedOpen = errors.New("failed to open file")
errFailedWrite = errors.New("failed to write file")
errPathIsNonDirectory = errors.New("path exists, but it's not a directory")
errDirectoryExists = errors.New("expected directory to not exist")
errDirectoryCreateFailed = errors.New("failed to create directory")
errInvalidSymlink = errors.New("invalid symlink")
errInvalidLink = errors.New("invalid hard link")
errRead = errors.New("encountered error while reading")
errUnknownHeader = errors.New("encountered unknown header")
)
type stringMap map[string]struct{}
// Options controls the behavior of some tarball related operations.
type Options struct {
NoLchown bool
}
func init() {
if unsafe.Sizeof(syscall.Timespec{}.Nsec) == 8 {
// This is a 64 bit timespec
// os.Chtimes limits time to the following
maxTime = time.Unix(0, 1<<63-1)
} else {
// This is a 32 bit timespec
maxTime = time.Unix(1<<31-1, 0)
}
}