summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-10-08 19:42:11 +0000
committerRichard M. Stallman <rms@gnu.org>1995-10-08 19:42:11 +0000
commitc3326a514ea3d160006afb9a4ccd439d50051e58 (patch)
tree785748cd24f3f3e99ae9824c21898c2126500e75 /lisp
parent12ce94c117be634d589f3d2756fdfe489a6fdf5f (diff)
downloademacs-c3326a514ea3d160006afb9a4ccd439d50051e58.tar.gz
(server-start): Try both full hostname and shortened
hostname when deleting the socket file.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/server.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/server.el b/lisp/server.el
index 0d1e0827ba1..5097f987963 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -147,9 +147,18 @@ Prefix arg means just kill any existing server communications subprocess."
(set-process-sentinel server-process nil)
(condition-case () (delete-process server-process) (error nil))))
(condition-case () (delete-file "~/.emacs_server") (error nil))
- (condition-case ()
- (delete-file (format "/tmp/esrv%d-%s" (user-uid) (system-name)))
- (error nil))
+ (let* ((sysname (system-name))
+ (dot-index (string-match "\\." sysname)))
+ (condition-case ()
+ (delete-file (format "/tmp/esrv%d-%s" (user-uid) sysname))
+ (error nil))
+ ;; In case the server file name was made with a domainless hostname,
+ ;; try deleting that name too.
+ (if dot-index
+ (condition-case ()
+ (delete-file (format "/tmp/esrv%d-%s" (user-uid)
+ (substring sysname 0 dot-index)))
+ (error nil))))
;; If we already had a server, clear out associated status.
(while server-clients
(let ((buffer (nth 1 (car server-clients))))