diff components/lftp/patches/sun_collision.patch @ 406:f556f16e55d2

7018539 Problem with utility/lftp
author Petr Sumbera <petr.sumbera@oracle.com>
date Fri, 15 Jul 2011 09:36:41 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/lftp/patches/sun_collision.patch	Fri Jul 15 09:36:41 2011 -0700
@@ -0,0 +1,50 @@
+--- src/attach.h.orig	Fri Jun 17 05:58:31 2011
++++ src/attach.h	Wed Jul 13 01:57:06 2011
+@@ -88,9 +88,9 @@
+ 	    TimeoutS(1);
+ 	    return m;
+ 	 }
+-	 struct sockaddr_un sun;
+-	 socklen_t sa_len=sizeof(sun);
+-	 a_sock=accept(sock,(sockaddr*)&sun,&sa_len);
++	 struct sockaddr_un un;
++	 socklen_t sa_len=sizeof(un);
++	 a_sock=accept(sock,(sockaddr*)&un,&sa_len);
+ 	 if(a_sock==-1 && E_RETRY(errno)) {
+ 	    Block(sock,POLLIN);
+ 	    return m;
+@@ -161,11 +161,11 @@
+ 	 int fl=fcntl(sock,F_GETFL);
+ 	 fcntl(sock,F_SETFL,fl|O_NONBLOCK);
+ 	 fcntl(sock,F_SETFD,FD_CLOEXEC);
+-	 struct sockaddr_un sun;
+-	 memset(&sun,0,sizeof(sun));
+-	 sun.sun_family=AF_UNIX;
+-	 strncpy(sun.sun_path,path,sizeof(sun.sun_path));
+-	 if(bind(sock,(sockaddr*)&sun,SUN_LEN(&sun))==-1) {
++	 struct sockaddr_un un;
++	 memset(&un,0,sizeof(un));
++	 un.sun_family=AF_UNIX;
++	 strncpy(un.sun_path,path,sizeof(un.sun_path));
++	 if(bind(sock,(sockaddr*)&un,SUN_LEN(&un))==-1) {
+ 	    perror("bind");
+ 	    close(sock);
+ 	    sock=-1;
+@@ -219,12 +219,12 @@
+ 	 m=MOVED;
+       }
+       if(!connected) {
+-	 struct sockaddr_un sun;
+-	 memset(&sun,0,sizeof(sun));
+-	 sun.sun_family=AF_UNIX;
++	 struct sockaddr_un un;
++	 memset(&un,0,sizeof(un));
++	 un.sun_family=AF_UNIX;
+ 	 const char *path=AcceptTermFD::get_sock_path(pid);
+-	 strncpy(sun.sun_path,path,sizeof(sun.sun_path));
+-	 int res=connect(sock,(sockaddr*)&sun,SUN_LEN(&sun));
++	 strncpy(un.sun_path,path,sizeof(un.sun_path));
++	 int res=connect(sock,(sockaddr*)&un,SUN_LEN(&un));
+ 	 if(res==-1 && !NonFatalError(errno)) {
+ 	    error=Error::Fatal(xstring::format("connect(%s): %s",path,strerror(errno)));
+ 	    return MOVED;