aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-12-18 08:48:26 +0000
committerDan Nicolaescu2008-12-18 08:48:26 +0000
commitfd95644b937fb3e6e1285b21c2fc1ab901199e87 (patch)
treed505389ad56d77f9b1abaabd4dca23e69d8951b3
parent059f0a612aea0c4f485b6d316f6bf51375cf52d0 (diff)
downloademacs-fd95644b937fb3e6e1285b21c2fc1ab901199e87.tar.gz
emacs-fd95644b937fb3e6e1285b21c2fc1ab901199e87.zip
* 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.
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/emacsclient.c22
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/startup.el6
-rw-r--r--src/ChangeLog5
-rw-r--r--src/emacs.c5
6 files changed, 38 insertions, 8 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 @@
12008-12-18 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * emacsclient.c (start_daemon_and_retry_set_socket): Improve error
4 checking.
5
12008-12-14 Dan Nicolaescu <dann@ics.uci.edu> 62008-12-14 Dan Nicolaescu <dann@ics.uci.edu>
2 7
3 * emacsclient.c: Include syswait.h instead of sys/types.h. 8 * 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)
1433#ifndef WINDOWSNT 1433#ifndef WINDOWSNT
1434 pid_t dpid; 1434 pid_t dpid;
1435 int status; 1435 int status;
1436 pid_t p;
1437 1436
1438 dpid = fork (); 1437 dpid = fork ();
1439 1438
1440 if (dpid > 0) 1439 if (dpid > 0)
1441 { 1440 {
1442 p = waitpid (dpid, &status, WUNTRACED | WCONTINUED); 1441 pid_t w;
1442 w = waitpid (dpid, &status, WUNTRACED | WCONTINUED);
1443 1443
1444 /* Try connecting again, the daemon should have started by 1444 if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS(status))
1445 now. */ 1445 {
1446 message (TRUE, "daemon should have started, trying to connect again\n", dpid); 1446 message (TRUE, "Error: Could not start the Emacs daemon\n");
1447 exit (EXIT_FAILURE);
1448 }
1449
1450 /* Try connecting, the daemon should have started by now. */
1451 message (TRUE, "Emacs daemon should have started, trying to connect again\n");
1447 if ((emacs_socket = set_socket (1)) == INVALID_SOCKET) 1452 if ((emacs_socket = set_socket (1)) == INVALID_SOCKET)
1448 message (TRUE, "Cannot connect even after starting the daemon\n"); 1453 {
1454 message (TRUE, "Error: Cannot connect even after starting the Emacs daemon\n");
1455 exit (EXIT_FAILURE);
1456 }
1449 } 1457 }
1450 else if (dpid < 0) 1458 else if (dpid < 0)
1451 { 1459 {
1452 fprintf (stderr, "Cannot fork!\n"); 1460 fprintf (stderr, "Error: Cannot fork!\n");
1453 exit (1); 1461 exit (1);
1454 } 1462 }
1455 else 1463 else
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9adef563e0d..0c06b012fd6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12008-12-18 Dan Nicolaescu <dann@ics.uci.edu> 12008-12-18 Dan Nicolaescu <dann@ics.uci.edu>
2 2
3 * startup.el (command-line): Do not mention the server name in
4 case the user has not mentioned it, print a more explicit message.
5
3 * vc-dir.el (vc-dir-at-event): Rename from vc-at-event. Change 6 * vc-dir.el (vc-dir-at-event): Rename from vc-at-event. Change
4 all callers. 7 all callers.
5 8
diff --git a/lisp/startup.el b/lisp/startup.el
index 2fa1a6c15cd..6dc958cae3d 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1223,7 +1223,11 @@ the `--debug-init' option to view a complete error backtrace."
1223 (server-start) 1223 (server-start)
1224 (if server-process 1224 (if server-process
1225 (daemon-initialized) 1225 (daemon-initialized)
1226 (message "Unable to start daemon: Emacs server named %S already running" server-name) 1226 (if (stringp dn)
1227 (message
1228 "Unable to start daemon: Emacs server named %S already running"
1229 server-name)
1230 (message "Unable to start the daemon.\nAnother instance of Emacs is running the server, either as daemon or interactively.\nYou can use emacsclient to connect to that Emacs process."))
1227 (kill-emacs 1)))) 1231 (kill-emacs 1))))
1228 1232
1229 ;; Run emacs-session-restore (session management) if started by 1233 ;; Run emacs-session-restore (session management) if started by
diff --git a/src/ChangeLog b/src/ChangeLog
index 8177bea8a45..ccda62889f7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12008-12-18 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * emacs.c (main): Print and error and exit when no data is read
4 from the pipe.
5
12008-12-17 Jason Rumney <jasonr@gnu.org> 62008-12-17 Jason Rumney <jasonr@gnu.org>
2 7
3 * w32font.c (w32font_has_char): Always return -1. 8 * w32font.c (w32font_has_char): Always return -1.
diff --git a/src/emacs.c b/src/emacs.c
index bd733da303f..4ebf136063a 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1129,6 +1129,11 @@ main (int argc, char **argv)
1129 fprintf (stderr, "Error reading status from child\n"); 1129 fprintf (stderr, "Error reading status from child\n");
1130 exit (1); 1130 exit (1);
1131 } 1131 }
1132 else if (retval == 0)
1133 {
1134 fprintf (stderr, "Error: server did not start correctly\n");
1135 exit (1);
1136 }
1132 1137
1133 close (daemon_pipe[0]); 1138 close (daemon_pipe[0]);
1134 exit (0); 1139 exit (0);