From 210a2d70570792f8fac53960557232de910bff37 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 5 Sep 2021 15:38:46 -0700 Subject: add dep on Anaphora and use APROG1, ALET & AAND in various places Signed-off-by: Sean Whitton --- src/connection/chroot.lisp | 7 +++---- src/connection/ssh.lisp | 5 ++--- src/connection/sudo.lisp | 9 ++++----- 3 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src/connection') diff --git a/src/connection/chroot.lisp b/src/connection/chroot.lisp index 8b144cb..70a603d 100644 --- a/src/connection/chroot.lisp +++ b/src/connection/chroot.lisp @@ -81,10 +81,9 @@ should be the mount point, without the chroot's root prefixed.") when (and (subtypep (type-of volume) 'disk:filesystem) (slot-boundp volume 'disk:mount-point) (subpathp (disk:mount-point volume) into)) - collect (let ((copy (disk:copy-volume-and-contents volume))) - (setf (disk:mount-point copy) - (in-chroot-pathname (disk:mount-point copy) into)) - copy) + collect (aprog1 (disk:copy-volume-and-contents volume) + (setf (disk:mount-point it) + (in-chroot-pathname (disk:mount-point it) into))) else collect volume))) (defmethod propagate-connattr diff --git a/src/connection/ssh.lisp b/src/connection/ssh.lisp index 38fd2ae..f4d30cc 100644 --- a/src/connection/ssh.lisp +++ b/src/connection/ssh.lisp @@ -24,9 +24,8 @@ user) (declare (ignore remaining)) (informat 1 "~&Establishing SSH connection to ~A" hop) - (let ((connection (make-instance 'ssh-connection :hostname hop :user user))) - (mrun "ssh" (ssh-host connection) ":") - connection)) + (aprog1 (make-instance 'ssh-connection :hostname hop :user user) + (mrun "ssh" (ssh-host it) ":"))) (defclass ssh-connection (shell-wrap-connection) ((hostname diff --git a/src/connection/sudo.lisp b/src/connection/sudo.lisp index 4c817f8..da50673 100644 --- a/src/connection/sudo.lisp +++ b/src/connection/sudo.lisp @@ -62,14 +62,13 @@ 'sudo-connection :connattrs `(:remote-user ,user) :password-file (and password - (let ((file (mktemp))) + (aprog1 (mktemp) ;; We'll send the password followed by ^M, then the ;; real stdin. Use CODE-CHAR in this way so that we ;; can be sure ASCII ^M is what will get emitted. - (writefile file (strcat (passphrase password) - (string (code-char 13))) - :mode #o600) - file)))) + (writefile it (strcat (passphrase password) + (string (code-char 13))) + :mode #o600))))) (defmethod connection-teardown :after ((connection sudo-connection)) (when-let ((file (slot-value connection 'password-file))) -- cgit v1.2.3