mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luiz Fernando N. Capitulino" <lcapitulino@conectiva.com.br>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, davem@davemloft.net
Subject: [PATCH 1/2] - net/socket.c::sys_bind() cleanup.
Date: Tue, 16 Nov 2004 18:55:17 -0200	[thread overview]
Message-ID: <20041116185517.3314ac35.lcapitulino@conectiva.com.br> (raw)


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

             reply	other threads:[~2004-11-16 22:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-16 20:55 Luiz Fernando N. Capitulino [this message]
2004-11-17  0:52 ` Jesper Juhl
2004-11-17  4:16   ` James Morris
2004-11-17  9:55     ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041116185517.3314ac35.lcapitulino@conectiva.com.br \
    --to=lcapitulino@conectiva.com.br \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®