patch-1.3.37 linux/net/unix/af_unix.c

Next file: linux/scripts/Configure
Previous file: linux/net/ipv4/udp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.36/linux/net/unix/af_unix.c linux/net/unix/af_unix.c
@@ -18,6 +18,7 @@
  *		Niibe Yutaka	:	async I/O support.
  *		Carsten Paeth	:	PF_UNIX check, address fixes.
  *		Alan Cox	:	Limit size of allocated blocks.
+ *		Alan Cox	:	Fixed the stupid socketpair bug.
  */
 
 #include <linux/config.h>
@@ -46,7 +47,7 @@
 #include <net/af_unix.h>
 #include <linux/proc_fs.h>
 
-static unix_socket *volatile unix_socket_list=NULL;
+static unix_socket * unix_socket_list=NULL;
 
 #define min(a,b)	(((a)<(b))?(a):(b))
 
@@ -68,25 +69,19 @@
  
 static void unix_remove_socket(unix_socket *sk)
 {
-	unix_socket *s;
+	unix_socket **s;
 	
 	cli();
-	s=unix_socket_list;
-	if(s==sk)
-	{
-		unix_socket_list=s->next;
-		sti();
-		return;
-	}
-	while(s && s->next)
+	s = &unix_socket_list;
+
+	while(*s!=NULL)
 	{
-		if(s->next==sk)
+		if(*s==sk)
 		{
-			s->next=sk->next;
-			sti();
-			return;
+			*s=sk->next;
+			break;
 		}
-		s=s->next;
+		s=&((*s)->next);
 	}
 	sti();
 }
@@ -279,7 +274,7 @@
 	skb_queue_head_init(&sk->back_log);
 	sk->protinfo.af_unix.family=AF_UNIX;
 	sk->protinfo.af_unix.inode=NULL;
-	sk->protinfo.af_unix.locks=1;	/* Us */
+	sk->protinfo.af_unix.locks=1;		/* Us */
 	sk->protinfo.af_unix.readsem=MUTEX;	/* single task reading lock */
 	sk->protinfo.af_unix.name=NULL;
 	sk->protinfo.af_unix.other=NULL;
@@ -540,20 +535,8 @@
 
 static int unix_socketpair(struct socket *a, struct socket *b)
 {
-	int err;
 	unix_socket *ska,*skb;	
 	
-	err=unix_create(a, 0);
-	if(err)
-		return err;
-	err=unix_create(b, 0);
-	if(err)
-	{
-		unix_release(a, NULL);
-		a->data=NULL;
-		return err;
-	}
-
 	ska=a->data;
 	skb=b->data;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this