local: when using -l fix setting modification times of symlinks #1152

Before this change it was setting the modification times of the things
that the symlinks pointed to.

Note that this is only implemented for unix style OSes.  Other OSes
will not attempt to set the modification time of a symlink.
This commit is contained in:
Nick Craig-Wood
2019-01-27 19:14:55 +00:00
parent 23e06cedbd
commit 52763e1918
3 changed files with 54 additions and 1 deletions

View File

@ -744,7 +744,12 @@ func (o *Object) ModTime() time.Time {
// SetModTime sets the modification time of the local fs object
func (o *Object) SetModTime(modTime time.Time) error {
err := os.Chtimes(o.path, modTime, modTime)
var err error
if o.translatedLink {
err = lChtimes(o.path, modTime, modTime)
} else {
err = os.Chtimes(o.path, modTime, modTime)
}
if err != nil {
return err
}