patch-1.3.44 linux/net/socket.c

Next file: linux/net/unix/af_unix.c
Previous file: linux/net/netrom/nr_dev.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.43/linux/net/socket.c linux/net/socket.c
@@ -670,21 +670,23 @@
 asmlinkage int sys_listen(int fd, int backlog)
 {
 	struct socket *sock;
-
+	int err=-EOPNOTSUPP;
+	
 	if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL)
 		return(-EBADF);
 	if (!(sock = sockfd_lookup(fd, NULL))) 
 		return(-ENOTSOCK);
 
 	if (sock->state != SS_UNCONNECTED) 
-	{
 		return(-EINVAL);
-	}
 
 	if (sock->ops && sock->ops->listen)
-		sock->ops->listen(sock, backlog);
-	sock->flags |= SO_ACCEPTCON;
-	return(0);
+	{
+		err=sock->ops->listen(sock, backlog);
+		if(!err)
+			sock->flags |= SO_ACCEPTCON;
+	}
+	return(err);
 }
 
 

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