summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-02-12 12:52:43 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2018-02-12 12:57:58 -0800
commitd43a724f4ee247ad7a95d9e6ef174c7d16195fbe (patch)
tree48d9180e3ecfe87dea83b06939d2d6d36ac1d158 /src/emacs.c
parente1ca0ea87222e70710b3878ac80ed01f2378f050 (diff)
downloademacs-d43a724f4ee247ad7a95d9e6ef174c7d16195fbe.tar.gz
Minor cleanups for server-name fix (Bug#24218)
* lisp/server.el (server--external-socket-initialized): Rename from server-external-socket-initialised, since it should be private and Emacs uses American spelling. All uses changed. * src/emacs.c, src/lisp.h: Revert previous changes, as the initialization is now done in src/process.c, which already includes the relevant files. * src/process.c (union u_sockaddr): Move decl to top level. (external_sock_name, Fget_external_sockname): Remove, replacing with Vinternal__external_sockname. All uses changed. (init_process_emacs): Deduce socket name ourselves rather than have main.c do it. Use conv_sockaddr_to_lisp instead of doing it by hand. Conditionalize it on HAVE_GETSOCKNAME.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/emacs.c b/src/emacs.c
index c423faf6c0d..8ea61b71fb7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -60,7 +60,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#ifdef HAVE_LIBSYSTEMD
# include <systemd/sd-daemon.h>
# include <sys/socket.h>
-# include <sys/un.h>
#endif
#ifdef HAVE_WINDOW_SYSTEM
@@ -1003,7 +1002,6 @@ main (int argc, char **argv)
int sockfd = -1;
- char *sockname = NULL;
if (argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, NULL, &skip_args)
|| argmatch (argv, argc, "-fg-daemon", "--fg-daemon", 10, &dname_arg, &skip_args))
@@ -1063,16 +1061,8 @@ main (int argc, char **argv)
"Try 'Accept=false' in the Emacs socket unit file.\n"));
else if (systemd_socket == 1
&& (0 < sd_is_socket (SD_LISTEN_FDS_START,
- AF_UNIX, SOCK_STREAM, 1)))
- {
- struct sockaddr_un sockaddr;
- socklen_t sockaddr_sz = sizeof(sockaddr);
-
- sockfd = SD_LISTEN_FDS_START;
-
- if (!getsockname(sockfd, &sockaddr, &sockaddr_sz))
- sockname = strdup(sockaddr.sun_path);
- }
+ AF_UNSPEC, SOCK_STREAM, 1)))
+ sockfd = SD_LISTEN_FDS_START;
#endif /* HAVE_LIBSYSTEMD */
#ifdef USE_GTK
@@ -1670,7 +1660,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
/* This can create a thread that may call getenv, so it must follow
all calls to putenv and setenv. Also, this sets up
add_keyboard_wait_descriptor, which init_display uses. */
- init_process_emacs (sockfd, sockname);
+ init_process_emacs (sockfd);
init_keyboard (); /* This too must precede init_sys_modes. */
if (!noninteractive)