+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.
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];
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';
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))
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';
}
}
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 */