From af5441dcd9033e81da43ab77887a7b5aac693ab6 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 9 Aug 2016 22:18:46 +0200 Subject: fusefrontend: use NsecToTimespec() for Utimens This fixes a build problem on 32-bit hosts: internal/fusefrontend/file.go:400: cannot use a.Unix() (type int64) as type int32 in assignment internal/fusefrontend/file.go:406: cannot use m.Unix() (type int64) as type int32 in assignment It also enables full nanosecond timestamps for dates after 1970. --- internal/fusefrontend/fs.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'internal/fusefrontend/fs.go') diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index 5367622..1219479 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -230,15 +230,18 @@ func (fs *FS) Truncate(path string, offset uint64, context *fuse.Context) (code return code } -func (fs *FS) Utimens(path string, Atime *time.Time, Mtime *time.Time, context *fuse.Context) (code fuse.Status) { +func (fs *FS) Utimens(path string, a *time.Time, m *time.Time, context *fuse.Context) (code fuse.Status) { if fs.isFiltered(path) { return fuse.EPERM } - cPath, err := fs.encryptPath(path) + cPath, err := fs.getBackingPath(path) if err != nil { return fuse.ToStatus(err) } - return fs.FileSystem.Utimens(cPath, Atime, Mtime, context) + ts := make([]syscall.Timespec, 2) + ts[0] = utimeToTimespec(a) + ts[1] = utimeToTimespec(m) + return fuse.ToStatus(syscall.UtimesNano(cPath, ts)) } func (fs *FS) StatFs(path string) *fuse.StatfsOut { -- cgit v1.2.3