aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorMiles Bader2007-10-27 09:07:17 +0000
committerMiles Bader2007-10-27 09:07:17 +0000
commitfdc9061358d3654e14bfc1419632e1d6c6c5c13e (patch)
tree00f5484d576513deddd938a9a277d0db860b9a5b /lib-src
parentebe4c71027cd6ec8583631e895e7fdd3decfc099 (diff)
parentb6ff295c434269fe824ec47cbfc87c6a02dfd94d (diff)
downloademacs-fdc9061358d3654e14bfc1419632e1d6c6c5c13e.tar.gz
emacs-fdc9061358d3654e14bfc1419632e1d6c6c5c13e.zip
Merge from emacs--rel--22
Patches applied: * emacs--rel--22 (patch 131-137) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 261-262) - Update from CVS Revision: emacs@sv.gnu.org/emacs--devo--0--patch-908
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/emacsclient.c27
2 files changed, 30 insertions, 2 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index d4a05722a3c..14b668d2d24 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -8,6 +8,11 @@
8 (set_local_socket, set_socket, main): Use egetenv, not getenv. 8 (set_local_socket, set_socket, main): Use egetenv, not getenv.
9 (w32_get_resource, w32_getenv) [WINDOWSNT]: New functions. 9 (w32_get_resource, w32_getenv) [WINDOWSNT]: New functions.
10 10
112007-10-25 Jason Rumney <jasonr@gnu.org>
12
13 * emacsclient.c (sock_err_message): New function.
14 (set_tcp_socket): Use it.
15
112007-10-09 Juanma Barranquero <lekktu@gmail.com> 162007-10-09 Juanma Barranquero <lekktu@gmail.com>
12 17
13 * emacsclient.c (print_help_and_exit): Fix space to improve 18 * emacsclient.c (print_help_and_exit): Fix space to improve
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index a48a33f68b8..99e0dc3ce3d 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -666,6 +666,29 @@ int sblen = 0; /* Fill pointer for the send buffer. */
666/* Socket used to communicate with the Emacs server process. */ 666/* Socket used to communicate with the Emacs server process. */
667HSOCKET emacs_socket = 0; 667HSOCKET emacs_socket = 0;
668 668
669/* On Windows, the socket library was historically separate from the standard
670 C library, so errors are handled differently. */
671void
672sock_err_message (function_name)
673 char *function_name;
674{
675#ifdef WINDOWSNT
676 char* msg = NULL;
677
678 FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
679 | FORMAT_MESSAGE_ALLOCATE_BUFFER
680 | FORMAT_MESSAGE_ARGUMENT_ARRAY,
681 NULL, WSAGetLastError (), 0, (LPTSTR)&msg, 0, NULL);
682
683 message (TRUE, "%s: %s: %s\n", progname, function_name, msg);
684
685 LocalFree (msg);
686#else
687 message (TRUE, "%s: %s: %s\n", progname, function_name, strerror (errno));
688#endif
689}
690
691
669/* Let's send the data to Emacs when either 692/* Let's send the data to Emacs when either
670 - the data ends in "\n", or 693 - the data ends in "\n", or
671 - the buffer is full (but this shouldn't happen) 694 - the buffer is full (but this shouldn't happen)
@@ -957,7 +980,7 @@ set_tcp_socket ()
957 */ 980 */
958 if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) 981 if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
959 { 982 {
960 message (TRUE, "%s: socket: %s\n", progname, strerror (errno)); 983 sock_err_message ("socket");
961 return INVALID_SOCKET; 984 return INVALID_SOCKET;
962 } 985 }
963 986
@@ -966,7 +989,7 @@ set_tcp_socket ()
966 */ 989 */
967 if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) 990 if (connect (s, (struct sockaddr *) &server, sizeof server) < 0)
968 { 991 {
969 message (TRUE, "%s: connect: %s\n", progname, strerror (errno)); 992 sock_err_message ("connect");
970 return INVALID_SOCKET; 993 return INVALID_SOCKET;
971 } 994 }
972 995