mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-29 19:45:39 +00:00
3fe21921b5
Use UtimesNanoAt from golang.org/x/sys/unix instead of manually crafting the syscall. Since UtimesNanoAt is provided for all unix-like OSes, factor out lchtimes to its own file with appropriate build tags. This allows to make use of it on darwin, dragonfly, freebsd, openbsd, netbsd and solaris in addition to linux. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
21 lines
391 B
Go
21 lines
391 B
Go
// +build linux
|
|
|
|
package mtree
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"os"
|
|
|
|
"github.com/vbatts/go-mtree/xattr"
|
|
)
|
|
|
|
func xattrUpdateKeywordFunc(path string, kv KeyVal) (os.FileInfo, error) {
|
|
buf, err := base64.StdEncoding.DecodeString(kv.Value())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if err := xattr.Set(path, kv.Keyword().Suffix(), buf); err != nil {
|
|
return nil, err
|
|
}
|
|
return os.Lstat(path)
|
|
}
|