mirror of
https://github.com/vbatts/tar-split.git
synced 2024-11-16 13:28:37 +00:00
Merge pull request #25 from stephen679/get_all_mode_bits
keywords: obtain all permission bits
This commit is contained in:
commit
460fce6502
1 changed files with 11 additions and 1 deletions
12
keywords.go
12
keywords.go
|
@ -166,7 +166,17 @@ var (
|
|||
|
||||
var (
|
||||
modeKeywordFunc = func(path string, info os.FileInfo) (string, error) {
|
||||
return fmt.Sprintf("mode=%#o", info.Mode().Perm()), nil
|
||||
permissions := info.Mode().Perm()
|
||||
if os.ModeSetuid&info.Mode() > 0 {
|
||||
permissions |= (1 << 11)
|
||||
}
|
||||
if os.ModeSetgid&info.Mode() > 0 {
|
||||
permissions |= (1 << 10)
|
||||
}
|
||||
if os.ModeSticky&info.Mode() > 0 {
|
||||
permissions |= (1 << 9)
|
||||
}
|
||||
return fmt.Sprintf("mode=%#o", permissions), nil
|
||||
}
|
||||
sizeKeywordFunc = func(path string, info os.FileInfo) (string, error) {
|
||||
return fmt.Sprintf("size=%d", info.Size()), nil
|
||||
|
|
Loading…
Reference in a new issue