The LocalSocket implementation didn't handle EINTR correctly (not at
all). I fixed this and now the local sockets work quite well with the X
peers:

http://kennke.org/~roman/xawt/

IMO they should be enabled by default.

2006-04-19  Roman Kennke  <[EMAIL PROTECTED]>

        * native/jni/java-net/local.c
        (local_read): Handle EINTR correctly.
        (local_write): Likewise.

/Roman
-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: native/jni/java-net/local.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/local.c,v
retrieving revision 1.1
diff -u -1 -0 -r1.1 local.c
--- native/jni/java-net/local.c	16 Apr 2006 21:54:09 -0000	1.1
+++ native/jni/java-net/local.c	19 Apr 2006 18:09:47 -0000
@@ -44,21 +44,20 @@
 
 #include <stddef.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <errno.h>
 
 #include <stdio.h>
 
 #include "local.h"
 
 const char *
 local_error (void)
 {
   return strerror (errno);
 }
@@ -163,20 +162,32 @@
   strncpy (saddr.sun_path, path, sizeof (saddr.sun_path));
   saddr.sun_path[sizeof (saddr.sun_path) - 1] = '\0';
   saddr.sun_family = AF_UNIX;
 
   return connect (fd, (struct sockaddr *) &saddr, SUN_LEN(&saddr));
 }
 
 int
 local_read (int fd, void *buf, int len)
 {
-  return read (fd, buf, len);
+  int count = -1;
+  do
+    {
+      count = read (fd, buf, len);
+    }
+  while (count == -1 && errno == EINTR);
+  return count;
 }
 
 int
 local_write (int fd, void *buf, int len)
 {
-  return write (fd, buf, len);
+  int count = -1;
+  do
+    {
+      count = write (fd, buf, len);
+    }
+  while (count == -1 && errno == EINTR);
+  return count;
 }
 
 #endif /* ENABLE_LOCAL_SOCKETS */

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to