diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 80ae71dfc64..f7dfedbd88d 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5880,12 +5880,12 @@ Nonexistent directories are removed from spec." "Determine remote `touch' command." (with-tramp-connection-property vec "touch" (tramp-message vec 5 "Finding a suitable `touch' command") - (let ((result (tramp-find-executable - vec "touch" (tramp-get-remote-path vec))) - (tmpfile (tramp-make-tramp-temp-name vec))) - ;; Busyboxes do support the "-t" option only when they have been - ;; built with the DESKTOP config option. Let's check it. - (when result + (when-let* ((result (tramp-find-executable + vec "touch" (tramp-get-remote-path vec))) + (tmpfile (tramp-make-tramp-temp-name vec))) + (prog1 result + ;; Busyboxes do support the "-t" option only when they have + ;; been built with the DESKTOP config option. Let's check it. (tramp-set-connection-property vec "touch-t" (tramp-send-command-and-check @@ -5895,16 +5895,13 @@ Nonexistent directories are removed from spec." result (format-time-string "%Y%m%d%H%M.%S") (tramp-file-local-name tmpfile)))) + ;; The touch command included in busybox (version 1.30.1-6) on + ;; OpenWrt does not have the option "-h". (tramp-set-connection-property vec "touch-h" (tramp-send-command-and-check - vec - (format - "%s -h %s" - result - (tramp-file-local-name tmpfile)))) - (delete-file tmpfile)) - result))) + vec (format "%s -h %s" result (tramp-file-local-name tmpfile)))) + (delete-file tmpfile))))) (defun tramp-get-remote-df (vec) "Determine remote `df' command."