aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2010-09-30 04:53:26 +0200
committerJuanma Barranquero2010-09-30 04:53:26 +0200
commit968ef9b4dae78c5badd7f377b26519c8840823e7 (patch)
tree295600dfe1afa8d91130d8adbb42c670e08d0cd7
parentcf16af423488fff17e43e5aca6fb76610284c1c3 (diff)
downloademacs-968ef9b4dae78c5badd7f377b26519c8840823e7.tar.gz
emacs-968ef9b4dae78c5badd7f377b26519c8840823e7.zip
lisp/server.el: Use just one way to pass the Emacs PID to emacsclient.
* lib-src/emacsclient.c (get_server_config): Don't read Emacs pid from the authentication file. * lisp/server.el (server-start): Don't write pid to the authentication file. (server-create-tty-frame): Don't send pid. (server-process-filter): Send pid at the start of every connection.
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/emacsclient.c13
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/server.el7
4 files changed, 17 insertions, 14 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 2c386257c10..33036c92ffd 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
12010-09-30 Juanma Barranquero <lekktu@gmail.com>
2
3 * emacsclient.c (get_server_config): Don't read Emacs pid from
4 the authentication file.
5
12010-09-29 Juanma Barranquero <lekktu@gmail.com> 62010-09-29 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * makefile.w32-in (../src/config.h): Remove target, it is stale. 8 * makefile.w32-in (../src/config.h): Remove target, it is stale.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 1f96c481129..4d8a835e56d 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -910,14 +910,13 @@ initialize_sockets (void)
910 910
911/* 911/*
912 * Read the information needed to set up a TCP comm channel with 912 * Read the information needed to set up a TCP comm channel with
913 * the Emacs server: host, port, pid and authentication string. 913 * the Emacs server: host, port, and authentication string.
914 */ 914 */
915int 915int
916get_server_config (struct sockaddr_in *server, char *authentication) 916get_server_config (struct sockaddr_in *server, char *authentication)
917{ 917{
918 char dotted[32]; 918 char dotted[32];
919 char *port; 919 char *port;
920 char *pid;
921 FILE *config = NULL; 920 FILE *config = NULL;
922 921
923 if (file_name_absolute_p (server_file)) 922 if (file_name_absolute_p (server_file))
@@ -948,12 +947,8 @@ get_server_config (struct sockaddr_in *server, char *authentication)
948 return FALSE; 947 return FALSE;
949 948
950 if (fgets (dotted, sizeof dotted, config) 949 if (fgets (dotted, sizeof dotted, config)
951 && (port = strchr (dotted, ':')) 950 && (port = strchr (dotted, ':')))
952 && (pid = strchr (port, ' '))) 951 *port++ = '\0';
953 {
954 *port++ = '\0';
955 *pid++ = '\0';
956 }
957 else 952 else
958 { 953 {
959 message (TRUE, "%s: invalid configuration info\n", progname); 954 message (TRUE, "%s: invalid configuration info\n", progname);
@@ -972,8 +967,6 @@ get_server_config (struct sockaddr_in *server, char *authentication)
972 967
973 fclose (config); 968 fclose (config);
974 969
975 emacs_pid = atoi (pid);
976
977 return TRUE; 970 return TRUE;
978} 971}
979 972
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c19eaaf9dcc..a5d171744e9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12010-09-30 Juanma Barranquero <lekktu@gmail.com>
2
3 * server.el (server-start): Don't write pid to the authentication file.
4 (server-create-tty-frame): Don't send pid.
5 (server-process-filter): Send pid at the start of every connection.
6
12010-09-30 Glenn Morris <rgm@gnu.org> 72010-09-30 Glenn Morris <rgm@gnu.org>
2 8
3 * calendar/diary-lib.el (view-diary-entries, list-diary-entries) 9 * calendar/diary-lib.el (view-diary-entries, list-diary-entries)
diff --git a/lisp/server.el b/lisp/server.el
index 3a48efed7da..87250fd3aaf 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -586,7 +586,6 @@ server or call `M-x server-force-delete' to forcibly disconnect it.")
586 (setq buffer-file-coding-system 'no-conversion) 586 (setq buffer-file-coding-system 'no-conversion)
587 (insert (format-network-address 587 (insert (format-network-address
588 (process-contact server-process :local)) 588 (process-contact server-process :local))
589 " " (int-to-string (emacs-pid))
590 "\n" auth-key))))))))) 589 "\n" auth-key)))))))))
591 590
592;;;###autoload 591;;;###autoload
@@ -706,9 +705,6 @@ Server mode runs a process that accepts commands from the
706 ;; Display *scratch* by default. 705 ;; Display *scratch* by default.
707 (switch-to-buffer (get-buffer-create "*scratch*") 'norecord) 706 (switch-to-buffer (get-buffer-create "*scratch*") 'norecord)
708 707
709 ;; Reply with our pid.
710 (server-send-string proc (concat "-emacs-pid "
711 (number-to-string (emacs-pid)) "\n"))
712 frame)) 708 frame))
713 709
714(defun server-create-window-system-frame (display nowait proc parent-id) 710(defun server-create-window-system-frame (display nowait proc parent-id)
@@ -889,6 +885,9 @@ The following commands are accepted by the client:
889 (condition-case err 885 (condition-case err
890 (progn 886 (progn
891 (server-add-client proc) 887 (server-add-client proc)
888 ;; Send our pid
889 (server-send-string proc (concat "-emacs-pid "
890 (number-to-string (emacs-pid)) "\n"))
892 (if (not (string-match "\n" string)) 891 (if (not (string-match "\n" string))
893 ;; Save for later any partial line that remains. 892 ;; Save for later any partial line that remains.
894 (when (> (length string) 0) 893 (when (> (length string) 0)