view components/lftp/patches/sun_collision.patch @ 446:e11ec815dd5b default tip

1589 package up xcowsay
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 01 Oct 2011 23:52:49 +0100
parents f556f16e55d2
children
line wrap: on
line source

--- 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;