f967a33ccc
There's no need to open the containing directory. This is exactly what syscall.UtimesNano does, except for the AT_SYMLINK_NOFOLLOW flag.
18 lines
434 B
Go
18 lines
434 B
Go
package fs
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"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")
|
|
}
|