diff options
author | Dan Nicolaescu <dann@ics.uci.edu> | 2008-12-18 08:48:26 +0000 |
---|---|---|
committer | Dan Nicolaescu <dann@ics.uci.edu> | 2008-12-18 08:48:26 +0000 |
commit | fd95644b937fb3e6e1285b21c2fc1ab901199e87 (patch) | |
tree | d505389ad56d77f9b1abaabd4dca23e69d8951b3 /lib-src | |
parent | 059f0a612aea0c4f485b6d316f6bf51375cf52d0 (diff) | |
download | emacs-fd95644b937fb3e6e1285b21c2fc1ab901199e87.tar.gz |
* emacs.c (main): Print and error and exit when no data is read
from the pipe.
* startup.el (command-line): Do not mention the server name in
case the user has not mentioned it, print a more explicit message.
* emacsclient.c (start_daemon_and_retry_set_socket): Improve error
checking.
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/ChangeLog | 5 | ||||
-rw-r--r-- | lib-src/emacsclient.c | 22 |
2 files changed, 20 insertions, 7 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 16d70d42973..b72487d22d8 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,8 @@ +2008-12-18 Dan Nicolaescu <dann@ics.uci.edu> + + * emacsclient.c (start_daemon_and_retry_set_socket): Improve error + checking. + 2008-12-14 Dan Nicolaescu <dann@ics.uci.edu> * emacsclient.c: Include syswait.h instead of sys/types.h. diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 2f18fee5047..22b5273f842 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1433,23 +1433,31 @@ start_daemon_and_retry_set_socket (void) #ifndef WINDOWSNT pid_t dpid; int status; - pid_t p; dpid = fork (); if (dpid > 0) { - p = waitpid (dpid, &status, WUNTRACED | WCONTINUED); + pid_t w; + w = waitpid (dpid, &status, WUNTRACED | WCONTINUED); - /* Try connecting again, the daemon should have started by - now. */ - message (TRUE, "daemon should have started, trying to connect again\n", dpid); + if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS(status)) + { + message (TRUE, "Error: Could not start the Emacs daemon\n"); + exit (EXIT_FAILURE); + } + + /* 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, "Cannot connect even after starting the daemon\n"); + { + message (TRUE, "Error: Cannot connect even after starting the Emacs daemon\n"); + exit (EXIT_FAILURE); + } } else if (dpid < 0) { - fprintf (stderr, "Cannot fork!\n"); + fprintf (stderr, "Error: Cannot fork!\n"); exit (1); } else |