Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 456cf216232cc3e7515dc836d78f9a33038d8d82 Mon Sep 17 00:00:00 2001
- From: John Peterson <john.peterson3@hotmail.com>
- Date: Mon, 21 May 2012 22:55:39 -0700
- Subject: [PATCH] Fixing nfsd-getattr and nfsd-setattr so that it reads and writes the correct time.
- _wstat64 and _wutime (and _futime) when called from nfs.exe read and write a time that is one hour into the future and one hour in the past, respectively. To offset this problem an adjustment is required to the value that is read and written.
- ---
- attr.cl | 8 +++++++-
- unicode-file.cl | 6 +++---
- 2 files changed, 10 insertions(+), 4 deletions(-)
- diff --git a/attr.cl b/attr.cl
- index e943598..c0c8393 100755
- --- a/attr.cl
- +++ b/attr.cl
- @@ -181,7 +181,13 @@
- (if (not (open-stream-p stream))
- (error "Something passed a closed stream to update-attr-times-and-size"))
- (if set-mtime
- - (sys-futime (excl.osi::stream-to-fd stream) 0))
- + (ff:with-static-fobject (utimbuf 'excl.osi::utimbuf
- + :allocation :foreign-static-gc)
- + (setf (ff:fslot-value utimbuf 'excl.osi::actime)
- + (+ 3600 (excl::cl-internal-real-time)))
- + (setf (ff:fslot-value utimbuf 'excl.osi::modtime)
- + (+ 3600 (excl::cl-internal-real-time)))
- + (sys-futime (excl.osi::stream-to-fd stream) utimbuf)))
- (let ((attr (update-atime-and-mtime fh))
- (pos (file-position stream)))
- (when (> pos (nfs-attr-size attr))
- diff --git a/unicode-file.cl b/unicode-file.cl
- index ec19e3e..032fe6c 100644
- --- a/unicode-file.cl
- +++ b/unicode-file.cl
- @@ -231,7 +231,7 @@ struct __stat64 {
- (macrolet ((slot (&rest rest)
- `(ff:fslot-value-typed 'stat64 :foreign-static-gc sb ,@rest)))
- (macrolet ((timeslot (name)
- - `(excl.osi:unix-to-universal-time (slot ,name :low))))
- + `(- (excl.osi:unix-to-universal-time (slot ,name :low)) 3600)))
- (let ((mode (slot 'mode)))
- (if (symlink-p filename)
- (setf mode #o0120777))
- @@ -327,9 +327,9 @@ struct __stat64 {
- (ff:with-static-fobject (utimbuf 'excl.osi::utimbuf
- :allocation :foreign-static-gc)
- (setf (ff:fslot-value utimbuf 'excl.osi::actime)
- - (universal-to-unix-time (or atime file-atime)))
- + (universal-to-unix-time (+ 3600 (or atime file-atime))))
- (setf (ff:fslot-value utimbuf 'excl.osi::modtime)
- - (universal-to-unix-time (or mtime file-mtime)))
- + (universal-to-unix-time (+ 3600 (or mtime file-mtime))))
- (multiple-value-bind (res errno) (syscall-wutime filespec utimbuf)
- (when (/= 0 res)
Add Comment
Please, Sign In to add comment