Guest User

Untitled

a guest
Oct 11th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. From 456cf216232cc3e7515dc836d78f9a33038d8d82 Mon Sep 17 00:00:00 2001
  2. From: John Peterson <john.peterson3@hotmail.com>
  3. Date: Mon, 21 May 2012 22:55:39 -0700
  4. Subject: [PATCH] Fixing nfsd-getattr and nfsd-setattr so that it reads and writes the correct time.
  5.  
  6. _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.
  7. ---
  8. attr.cl | 8 +++++++-
  9. unicode-file.cl | 6 +++---
  10. 2 files changed, 10 insertions(+), 4 deletions(-)
  11.  
  12. diff --git a/attr.cl b/attr.cl
  13. index e943598..c0c8393 100755
  14. --- a/attr.cl
  15. +++ b/attr.cl
  16. @@ -181,7 +181,13 @@
  17. (if (not (open-stream-p stream))
  18. (error "Something passed a closed stream to update-attr-times-and-size"))
  19. (if set-mtime
  20. - (sys-futime (excl.osi::stream-to-fd stream) 0))
  21. + (ff:with-static-fobject (utimbuf 'excl.osi::utimbuf
  22. + :allocation :foreign-static-gc)
  23. + (setf (ff:fslot-value utimbuf 'excl.osi::actime)
  24. + (+ 3600 (excl::cl-internal-real-time)))
  25. + (setf (ff:fslot-value utimbuf 'excl.osi::modtime)
  26. + (+ 3600 (excl::cl-internal-real-time)))
  27. + (sys-futime (excl.osi::stream-to-fd stream) utimbuf)))
  28. (let ((attr (update-atime-and-mtime fh))
  29. (pos (file-position stream)))
  30. (when (> pos (nfs-attr-size attr))
  31. diff --git a/unicode-file.cl b/unicode-file.cl
  32. index ec19e3e..032fe6c 100644
  33. --- a/unicode-file.cl
  34. +++ b/unicode-file.cl
  35. @@ -231,7 +231,7 @@ struct __stat64 {
  36. (macrolet ((slot (&rest rest)
  37. `(ff:fslot-value-typed 'stat64 :foreign-static-gc sb ,@rest)))
  38. (macrolet ((timeslot (name)
  39. - `(excl.osi:unix-to-universal-time (slot ,name :low))))
  40. + `(- (excl.osi:unix-to-universal-time (slot ,name :low)) 3600)))
  41. (let ((mode (slot 'mode)))
  42. (if (symlink-p filename)
  43. (setf mode #o0120777))
  44. @@ -327,9 +327,9 @@ struct __stat64 {
  45. (ff:with-static-fobject (utimbuf 'excl.osi::utimbuf
  46. :allocation :foreign-static-gc)
  47. (setf (ff:fslot-value utimbuf 'excl.osi::actime)
  48. - (universal-to-unix-time (or atime file-atime)))
  49. + (universal-to-unix-time (+ 3600 (or atime file-atime))))
  50. (setf (ff:fslot-value utimbuf 'excl.osi::modtime)
  51. - (universal-to-unix-time (or mtime file-mtime)))
  52. + (universal-to-unix-time (+ 3600 (or mtime file-mtime))))
  53.  
  54. (multiple-value-bind (res errno) (syscall-wutime filespec utimbuf)
  55. (when (/= 0 res)
Add Comment
Please, Sign In to add comment