merge of '49118a4c6035353c0f8cf1aa30297dd36e43241f'
[vuplus_openembedded] / packages / classpath / files / javanet-local.patch
1 Index: native/jni/java-net/local.c
2 ===================================================================
3 RCS file: /sources/classpath/classpath/native/jni/java-net/local.c,v
4 retrieving revision 1.4
5 diff -u -r1.4 local.c
6 --- native/jni/java-net/local.c 17 Apr 2007 21:46:27 -0000      1.4
7 +++ native/jni/java-net/local.c 27 Jun 2008 13:14:40 -0000
8 @@ -73,27 +73,18 @@
9    return socket (PF_UNIX, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
10  }
11  
12 -static int gcc_sucks = 0;
13 -
14  int
15  local_bind (int fd, const char *addr)
16  {
17    struct sockaddr_un saddr;
18  
19 -  /* For some reason, GCC 4.0.1 on Darwin/x86 MODIFIES the `addr'
20 -     pointer in the CALLER's STACK FRAME after calling this function,
21 -     but if we add this statement below, it doesn't!  */
22 -  if (gcc_sucks)
23 -    fprintf (stderr, "bind %p\n", addr);
24 -
25 -  if (strlen (addr) > sizeof (saddr.sun_path))
26 +  if (strlen (addr) >= sizeof (saddr.sun_path))
27      {
28        errno = ENAMETOOLONG;
29        return -1;
30      }
31  
32 -  strncpy (saddr.sun_path, addr, sizeof (saddr.sun_path));
33 -  saddr.sun_path[sizeof (saddr.sun_path)] = '\0';
34 +  strcpy (saddr.sun_path, addr);
35    saddr.sun_family = AF_LOCAL;
36  
37    return bind (fd, (struct sockaddr *) &saddr, SUN_LEN (&saddr));