aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorDan Nicolaescu2008-12-18 08:48:26 +0000
committerDan Nicolaescu2008-12-18 08:48:26 +0000
commitfd95644b937fb3e6e1285b21c2fc1ab901199e87 (patch)
treed505389ad56d77f9b1abaabd4dca23e69d8951b3 /lib-src
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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/emacsclient.c22
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 @@
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