Commit ac219034 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/pathfs: fix confusion between atime and mtime in loopbackFileSystem.Utimens.

parent cb9381c5
...@@ -70,7 +70,7 @@ func (fs *loopbackFileSystem) Utimens(path string, a *time.Time, m *time.Time, c ...@@ -70,7 +70,7 @@ func (fs *loopbackFileSystem) Utimens(path string, a *time.Time, m *time.Time, c
if m == nil { if m == nil {
ts[1].Nsec = _UTIME_OMIT ts[1].Nsec = _UTIME_OMIT
} else { } else {
ts[1] = syscall.NsecToTimespec(a.UnixNano()) ts[1] = syscall.NsecToTimespec(m.UnixNano())
ts[1].Nsec = 0 ts[1].Nsec = 0
} }
......
...@@ -27,8 +27,11 @@ func TestTouch(t *testing.T) { ...@@ -27,8 +27,11 @@ func TestTouch(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Lstat failed: %v", err) t.Fatalf("Lstat failed: %v", err)
} }
if stat.Atim.Sec != 42 || stat.Mtim.Sec != 43 { if stat.Atim.Sec != 42 {
t.Errorf("Got wrong timestamps %v", stat) t.Errorf("Got atime.sec %d, want 42. Stat_t was %#v", stat.Atim.Sec, stat)
}
if stat.Mtim.Sec != 43 {
t.Errorf("Got mtime.sec %d, want 43. Stat_t was %#v", stat.Mtim.Sec, stat)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment