]> git.eshelyaron.com Git - emacs.git/commitdiff
Delete the emacs-server directory upon Emacs exit
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 24 Nov 2020 05:41:03 +0000 (06:41 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 24 Nov 2020 05:41:03 +0000 (06:41 +0100)
* lisp/server.el (server-start): Delete the server directory upon
Emacs exit (bug#44644).  This fixes the problem of /tmp/emacs0
directories being left behind when running an Emacs server as root.

lisp/server.el

index 763f651fefc219be36b9e551c105bc3e710a26a2..1219b0212249d110f2d3d581a247f712cb156e5f 100644 (file)
@@ -648,7 +648,12 @@ the `server-process' variable."
            ;; Remove any leftover socket or authentication file.
            (ignore-errors
              (let (delete-by-moving-to-trash)
-               (delete-file server-file)))
+               (delete-file server-file)
+               ;; Also delete the directory that the server file was
+               ;; created in.  There may be other servers running,
+               ;; too, so this may fail.
+               (ignore-errors
+                 (delete-directory (file-name-directory server-file)))))
          (setq server-mode nil) ;; already set by the minor mode code
          (display-warning
           'server