Commit f498bfe0 authored by Yongwoo Park's avatar Yongwoo Park

fix compilation error on ubuntu-32bit

time.Unix() returns int64 regardless of target platform but timeval is
defined as int32 values on ubuntu-32bit
NsecToTimeval has a nanosecond problem(negative value) before epoch but
still can use second
parent e78f4a07
...@@ -27,13 +27,15 @@ func (f *loopbackFile) Utimens(a *time.Time, m *time.Time) fuse.Status { ...@@ -27,13 +27,15 @@ func (f *loopbackFile) Utimens(a *time.Time, m *time.Time) fuse.Status {
if a == nil { if a == nil {
ts[0].Nsec = _UTIME_OMIT ts[0].Nsec = _UTIME_OMIT
} else { } else {
ts[0].Sec = a.Unix() ts[0] = syscall.NsecToTimespec(a.UnixNano())
ts[0].Nsec = 0
} }
if m == nil { if m == nil {
ts[1].Nsec = _UTIME_OMIT ts[1].Nsec = _UTIME_OMIT
} else { } else {
ts[1].Sec = m.Unix() ts[1] = syscall.NsecToTimespec(a.UnixNano())
ts[1].Nsec = 0
} }
f.lock.Lock() f.lock.Lock()
......
...@@ -63,13 +63,15 @@ func (fs *loopbackFileSystem) Utimens(path string, a *time.Time, m *time.Time, c ...@@ -63,13 +63,15 @@ func (fs *loopbackFileSystem) Utimens(path string, a *time.Time, m *time.Time, c
if a == nil { if a == nil {
ts[0].Nsec = _UTIME_OMIT ts[0].Nsec = _UTIME_OMIT
} else { } else {
ts[0].Sec = a.Unix() ts[0] = syscall.NsecToTimespec(a.UnixNano())
ts[0].Nsec = 0
} }
if m == nil { if m == nil {
ts[1].Nsec = _UTIME_OMIT ts[1].Nsec = _UTIME_OMIT
} else { } else {
ts[1].Sec = m.Unix() ts[1] = syscall.NsecToTimespec(a.UnixNano())
ts[1].Nsec = 0
} }
err := sysUtimensat(0, fs.GetPath(path), &ts, _AT_SYMLINK_NOFOLLOW) err := sysUtimensat(0, fs.GetPath(path), &ts, _AT_SYMLINK_NOFOLLOW)
......
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