commit 73b96580ee3cf14699ebad3d0787ffbf33015a26 parent 961196e1d461190f2e237c65dc34e78ee063ffce Author: Tomas Hlavaty <tom@logand.com> Date: Sat, 17 Oct 2020 20:52:48 +0200 handle temporary file properly Diffstat:
M | emacs-framebuffer.el | | | 11 | +++++++---- |
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/emacs-framebuffer.el b/emacs-framebuffer.el @@ -136,10 +136,13 @@ (defun framebuffer-file-hash (file) (with-temp-buffer (if (file-remote-p file) - (let ((f (framebuffer-local-cache-file "emacs-framebuffer" "tmp"))) - (with-temp-file f - (insert (expand-file-name file))) - (call-process "sha256sum" nil t nil (expand-file-name f))) + (let ((f (make-temp-file "emacs-framebuffer."))) + (unwind-protect + (progn + (with-temp-file f + (insert (expand-file-name file))) + (call-process "sha256sum" nil t nil (expand-file-name f))) + (delete-file f))) (call-process "sha256sum" nil t nil (expand-file-name file))) (buffer-substring (point-min) (+ (point-min) 64))))