[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v |
Date: |
Sat, 27 Oct 2007 09:07:21 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Miles Bader <miles> 07/10/27 09:07:17
Index: lib-src/emacsclient.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -b -r1.113 -r1.114
--- lib-src/emacsclient.c 26 Oct 2007 15:46:22 -0000 1.113
+++ lib-src/emacsclient.c 27 Oct 2007 09:07:11 -0000 1.114
@@ -666,6 +666,29 @@
/* Socket used to communicate with the Emacs server process. */
HSOCKET emacs_socket = 0;
+/* On Windows, the socket library was historically separate from the standard
+ C library, so errors are handled differently. */
+void
+sock_err_message (function_name)
+ char *function_name;
+{
+#ifdef WINDOWSNT
+ char* msg = NULL;
+
+ FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
+ | FORMAT_MESSAGE_ALLOCATE_BUFFER
+ | FORMAT_MESSAGE_ARGUMENT_ARRAY,
+ NULL, WSAGetLastError (), 0, (LPTSTR)&msg, 0, NULL);
+
+ message (TRUE, "%s: %s: %s\n", progname, function_name, msg);
+
+ LocalFree (msg);
+#else
+ message (TRUE, "%s: %s: %s\n", progname, function_name, strerror (errno));
+#endif
+}
+
+
/* Let's send the data to Emacs when either
- the data ends in "\n", or
- the buffer is full (but this shouldn't happen)
@@ -957,7 +980,7 @@
*/
if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
{
- message (TRUE, "%s: socket: %s\n", progname, strerror (errno));
+ sock_err_message ("socket");
return INVALID_SOCKET;
}
@@ -966,7 +989,7 @@
*/
if (connect (s, (struct sockaddr *) &server, sizeof server) < 0)
{
- message (TRUE, "%s: connect: %s\n", progname, strerror (errno));
+ sock_err_message ("connect");
return INVALID_SOCKET;
}
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Miles Bader, 2007/10/09
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2007/10/09
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2007/10/26
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v,
Miles Bader <=
- [Emacs-diffs] Changes to emacs/lib-src/emacsclient.c,v, Juanma Barranquero, 2007/10/27