restic/internal/fs/node_linux.go

19 lines
434 B
Go
Raw Normal View History

package fs
import (
"syscall"
2017-07-23 12:21:03 +00:00
"github.com/restic/restic/internal/errors"
"golang.org/x/sys/unix"
)
func nodeRestoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
times := []unix.Timespec{
{Sec: utimes[0].Sec, Nsec: utimes[0].Nsec},
{Sec: utimes[1].Sec, Nsec: utimes[1].Nsec},
}
err := unix.UtimesNanoAt(unix.AT_FDCWD, path, times, unix.AT_SYMLINK_NOFOLLOW)
return errors.Wrap(err, "UtimesNanoAt")
}