comparison 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
comparison
equal deleted inserted replaced
405:c234ebd235a4 406:f556f16e55d2
1 --- src/attach.h.orig Fri Jun 17 05:58:31 2011
2 +++ src/attach.h Wed Jul 13 01:57:06 2011
3 @@ -88,9 +88,9 @@
4 TimeoutS(1);
5 return m;
6 }
7 - struct sockaddr_un sun;
8 - socklen_t sa_len=sizeof(sun);
9 - a_sock=accept(sock,(sockaddr*)&sun,&sa_len);
10 + struct sockaddr_un un;
11 + socklen_t sa_len=sizeof(un);
12 + a_sock=accept(sock,(sockaddr*)&un,&sa_len);
13 if(a_sock==-1 && E_RETRY(errno)) {
14 Block(sock,POLLIN);
15 return m;
16 @@ -161,11 +161,11 @@
17 int fl=fcntl(sock,F_GETFL);
18 fcntl(sock,F_SETFL,fl|O_NONBLOCK);
19 fcntl(sock,F_SETFD,FD_CLOEXEC);
20 - struct sockaddr_un sun;
21 - memset(&sun,0,sizeof(sun));
22 - sun.sun_family=AF_UNIX;
23 - strncpy(sun.sun_path,path,sizeof(sun.sun_path));
24 - if(bind(sock,(sockaddr*)&sun,SUN_LEN(&sun))==-1) {
25 + struct sockaddr_un un;
26 + memset(&un,0,sizeof(un));
27 + un.sun_family=AF_UNIX;
28 + strncpy(un.sun_path,path,sizeof(un.sun_path));
29 + if(bind(sock,(sockaddr*)&un,SUN_LEN(&un))==-1) {
30 perror("bind");
31 close(sock);
32 sock=-1;
33 @@ -219,12 +219,12 @@
34 m=MOVED;
35 }
36 if(!connected) {
37 - struct sockaddr_un sun;
38 - memset(&sun,0,sizeof(sun));
39 - sun.sun_family=AF_UNIX;
40 + struct sockaddr_un un;
41 + memset(&un,0,sizeof(un));
42 + un.sun_family=AF_UNIX;
43 const char *path=AcceptTermFD::get_sock_path(pid);
44 - strncpy(sun.sun_path,path,sizeof(sun.sun_path));
45 - int res=connect(sock,(sockaddr*)&sun,SUN_LEN(&sun));
46 + strncpy(un.sun_path,path,sizeof(un.sun_path));
47 + int res=connect(sock,(sockaddr*)&un,SUN_LEN(&un));
48 if(res==-1 && !NonFatalError(errno)) {
49 error=Error::Fatal(xstring::format("connect(%s): %s",path,strerror(errno)));
50 return MOVED;