lkml.org 
[lkml]   [2004]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] - net/socket.c::sys_bind() cleanup.

Hi,

net/socket.c::sys_bind() is a bit complex function, the patch
bellow makes it more clear.

Note that the code does the same thing, it only makes difference
for the programmer.

Agains't 2.6.10-rc2.


Signed-off-by: Luiz Capitulino <lcapitulino@conectiva.com.br>

net/socket.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)

diff -X /home/lcapitulino/kernels/2.6/dontdiff -Nparu a/net/socket.c a~/net/socket.c
--- a/net/socket.c 2004-10-31 18:44:25.000000000 -0200
+++ a~/net/socket.c 2004-10-31 18:52:01.000000000 -0200
@@ -1286,18 +1286,23 @@ asmlinkage long sys_bind(int fd, struct
char address[MAX_SOCK_ADDR];
int err;

- if((sock = sockfd_lookup(fd,&err))!=NULL)
- {
- if((err=move_addr_to_kernel(umyaddr,addrlen,address))>=0) {
- err = security_socket_bind(sock, (struct sockaddr *)address, addrlen);
- if (err) {
- sockfd_put(sock);
- return err;
- }
- err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen);
- }
- sockfd_put(sock);
- }
+ sock = sockfd_lookup(fd, &err);
+ if (!sock)
+ goto out;
+
+ err = move_addr_to_kernel(umyaddr, addrlen, address);
+ if (err)
+ goto out_put;
+
+ err = security_socket_bind(sock, (struct sockaddr *)address, addrlen);
+ if (err)
+ goto out_put;
+
+ err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen);
+
+ out_put:
+ sockfd_put(sock);
+ out:
return err;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.075 / U:0.120 seconds]
©2003-2011 Jasper Spaans. Advertise on this site