emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101734: * emacsclient.c (main): Retu


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101734: * emacsclient.c (main): Return EXIT_FAILURE if Emacs sends us an error string
Date: Sat, 02 Oct 2010 20:00:01 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101734
author: Wolfgang Schnerring <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2010-10-02 20:00:01 -0400
message:
  * emacsclient.c (main): Return EXIT_FAILURE if Emacs sends us an error string
  (Bug#6963).
modified:
  lib-src/ChangeLog
  lib-src/emacsclient.c
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2010-10-02 12:12:17 +0000
+++ b/lib-src/ChangeLog 2010-10-03 00:00:01 +0000
@@ -1,3 +1,8 @@
+2010-10-02  Wolfgang Schnerring  <address@hidden>  (tiny change)
+
+       * emacsclient.c (main): Return EXIT_FAILURE if Emacs sends us an
+       error string (Bug#6963).
+
 2010-10-02  Juanma Barranquero  <address@hidden>
 
        * makefile.w32-in (tags): Remove target.

=== modified file 'lib-src/emacsclient.c'
--- a/lib-src/emacsclient.c     2010-09-30 02:53:26 +0000
+++ b/lib-src/emacsclient.c     2010-10-03 00:00:01 +0000
@@ -1499,6 +1499,7 @@
   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 @@
   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 @@
             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 @@
           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 @@
   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 */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]