summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorWolfgang Schnerring <wosc@wosc.de>2010-10-02 20:00:01 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-10-02 20:00:01 -0400
commit3ecb8d931af361c043e240a17b18e4f3bcaf0d30 (patch)
tree86c8de6adfc1ba5e94fde9ae360ee594f520e656 /lib-src
parent986d19df1f2a63d8aa443f2132a6dced3bb9a4a4 (diff)
downloademacs-3ecb8d931af361c043e240a17b18e4f3bcaf0d30.tar.gz
* emacsclient.c (main): Return EXIT_FAILURE if Emacs sends us an error string
(Bug#6963).
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/emacsclient.c13
2 files changed, 15 insertions, 3 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 93d5e51d285..8c8671af2fc 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-02 Wolfgang Schnerring <wosc@wosc.de> (tiny change)
+
+ * emacsclient.c (main): Return EXIT_FAILURE if Emacs sends us an
+ error string (Bug#6963).
+
2010-10-02 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in (tags): Remove target.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 4d8a835e56d..d3d6f1cacd8 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1499,6 +1499,7 @@ main (int argc, char **argv)
char *cwd, *str;
char string[BUFSIZ+1];
int null_socket_name, null_server_file, start_daemon_if_needed;
+ int exit_status = EXIT_SUCCESS;
main_argv = argv;
progname = argv[0];
@@ -1698,7 +1699,8 @@ main (int argc, char **argv)
fsync (1);
/* Now, wait for an answer and print any messages. */
- while ((rl = recv (emacs_socket, string, BUFSIZ, 0)) > 0)
+ while (exit_status == EXIT_SUCCESS
+ && (rl = recv (emacs_socket, string, BUFSIZ, 0)) > 0)
{
char *p;
string[rl] = '\0';
@@ -1737,6 +1739,7 @@ main (int argc, char **argv)
printf ("\n");
fprintf (stderr, "*ERROR*: %s", str);
needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
+ exit_status = EXIT_FAILURE;
}
#ifdef SIGSTOP
else if (strprefix ("-suspend ", string))
@@ -1754,7 +1757,8 @@ main (int argc, char **argv)
if (needlf)
printf ("\n");
printf ("*ERROR*: Unknown message: %s", string);
- needlf = string[0] == '\0' ? needlf : string[strlen (string) - 1] != '\n';
+ needlf = string[0]
+ == '\0' ? needlf : string[strlen (string) - 1] != '\n';
}
}
@@ -1763,8 +1767,11 @@ main (int argc, char **argv)
fflush (stdout);
fsync (1);
+ if (rl < 0)
+ exit_status = EXIT_FAILURE;
+
CLOSE_SOCKET (emacs_socket);
- return EXIT_SUCCESS;
+ return exit_status;
}
#endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */