1
0
Fork 0

- [kami] made an effort to replicate the permissions when uploading a file.

This commit is contained in:
cage 2022-02-13 14:54:16 +01:00
parent f46fb4dc14
commit 560e01e09e
3 changed files with 26 additions and 18 deletions

View File

@ -314,6 +314,11 @@
(define-stat-time atime)
(defun get-stat-mode (file)
(let ((raw (nix:stat-mode (nix:stat file))))
(values raw
(logand raw #o777))))
(defun file-hash (file)
(num:fnv-hash-32 (slurp-file file :convert-to-string nil)))

View File

@ -118,6 +118,7 @@
(lambda (source-path destination-path)
(let* ((*stream* stream)
(*root-fid* root-fid))
(let ((source-permissions (fs:get-stat-mode source-path)))
(with-open-file (input-stream source-path
:direction :input
:element-type +octect-type+)
@ -135,7 +136,8 @@
(when (< read-so-far +download-buffer+)
(return-from write-loop t)))
(9p:9p-clunk *stream* fid)
(9p:read-all-pending-messages stream)))))))
(9p:change-mode *stream* *root-fid* destination-path source-permissions)
(9p:read-all-pending-messages stream))))))))
(defun query-path (stream root-fid)
(lambda (path what)

View File

@ -306,6 +306,7 @@
:get-stat-mtime
:get-stat-ctime
:get-stat-atime
:get-stat-mode
:file-outdated-p
:file-exists-p
:directory-exists-p