aboutsummaryrefslogtreecommitdiff
path: root/src/connection/shell-wrap.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/connection/shell-wrap.lisp')
-rw-r--r--src/connection/shell-wrap.lisp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/connection/shell-wrap.lisp b/src/connection/shell-wrap.lisp
index 883757b..70d094c 100644
--- a/src/connection/shell-wrap.lisp
+++ b/src/connection/shell-wrap.lisp
@@ -31,10 +31,16 @@
(connection-run c #?"test -r ${path} && cat ${path}" nil))
(if (= 0 exit) out (error "File ~S not readable" path))))
-(defmethod connection-writefile ((conn shell-wrap-connection) path contents)
+(defmethod connection-writefile ((conn shell-wrap-connection)
+ path
+ contents
+ umask)
(with-remote-temporary-file (temp)
- (connection-run conn #?"cat >${temp}" contents)
- (connection-run
- conn
- #?"mv ${(escape-sh-token temp)} ${(escape-sh-token path)}"
- nil)))
+ (connection-run conn
+ (if umask
+ (format nil "( umask ~O; cat >~A )" umask temp)
+ #?"cat >${temp}")
+ contents)
+ (connection-run conn
+ #?"mv ${(escape-sh-token temp)} ${(escape-sh-token path)}"
+ nil)))