diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2018-11-23 00:33:37 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2018-11-23 00:33:50 -0800 |
commit | 652dabfff6f99631f8f3d6c3a658f0b8895d48b0 (patch) | |
tree | 6b69ebd557fa7975edafdd378e589305861af05d /lib-src | |
parent | ef1f60301aabbcfc940bf8a826cd174ba2d0439c (diff) | |
download | emacs-652dabfff6f99631f8f3d6c3a658f0b8895d48b0.tar.gz |
emacsclient: fix child exit when exec fails
* lib-src/emacsclient.c (start_daemon_and_retry_set_socket):
If the execvp of Emacs fails exit instead of having the child
run on and do the work of the parent. Coalesce duplicate code.
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/emacsclient.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index b5ed2e0435a..9830eaecc6d 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1484,13 +1484,6 @@ start_daemon_and_retry_set_socket (void) /* Try connecting, the daemon should have started by now. */ message (true, "Emacs daemon should have started, trying to connect again\n"); - - if ((emacs_socket = set_socket (1)) == INVALID_SOCKET) - { - message (true, ("Error: Cannot connect " - "even after starting the Emacs daemon\n")); - exit (EXIT_FAILURE); - } } else if (dpid < 0) { @@ -1518,6 +1511,7 @@ start_daemon_and_retry_set_socket (void) # endif execvp ("emacs", d_argv); message (true, "%s: error starting emacs daemon\n", progname); + exit (EXIT_FAILURE); } # else /* WINDOWSNT */ DWORD wait_result; @@ -1583,13 +1577,15 @@ start_daemon_and_retry_set_socket (void) if (!w32_window_app ()) message (true, "Emacs daemon should have started, trying to connect again\n"); - if ((emacs_socket = set_socket (1)) == INVALID_SOCKET) +# endif /* WINDOWSNT */ + + emacs_socket = set_socket (true); + if (emacs_socket == INVALID_SOCKET) { message (true, "Error: Cannot connect even after starting the Emacs daemon\n"); exit (EXIT_FAILURE); } -# endif /* WINDOWSNT */ } #endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ |