qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
To: qemu-devel@nongnu.org
Cc: aliguori@linux.vnet.ibm.com,
	Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Subject: [Qemu-devel] [PATCH] net: Remove dead code from net/socket.c
Date: Fri, 14 May 2010 13:40:31 -0300	[thread overview]
Message-ID: <1273855231-22835-1-git-send-email-miguel.filho@gmail.com> (raw)

When a connection is accepted, the handler net_socket_accept() calls
net_socket_fd_init(). If the socket is UDP/multicast,
net_socket_fd_init() calls net_socket_fd_init_dgram, if
the socket is TCP it calls net_socket_fd_init_dgram_stream.

In both cases the info_str string is written inside
net_socket_fd_init_(stream|dgram), and after that, it is
overwritten on a subsequent snprintf() in net_socket_accept().

net_socket_fd_init_(stream|dgram) always puts into the info_str the fd
number, and this information is overwritten latter. No one has noticed this for
so long that I believe this code is dead.

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
---
 net/socket.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 1c4e153..b72a2de 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -267,11 +267,6 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan,
 
     nc = qemu_new_net_client(&net_dgram_socket_info, vlan, NULL, model, name);
 
-    snprintf(nc->info_str, sizeof(nc->info_str),
-	    "socket: fd=%d (%s mcast=%s:%d)",
-	    fd, is_connected ? "cloned" : "",
-	    inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
-
     s = DO_UPCAST(NetSocketState, nc, nc);
 
     s->fd = fd;
@@ -307,8 +302,6 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan,
 
     nc = qemu_new_net_client(&net_socket_info, vlan, NULL, model, name);
 
-    snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd);
-
     s = DO_UPCAST(NetSocketState, nc, nc);
 
     s->fd = fd;
-- 
1.7.1

             reply	other threads:[~2010-05-14 16:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 16:40 Miguel Di Ciurcio Filho [this message]
2010-05-14 17:03 ` [Qemu-devel] Re: [PATCH] net: Remove dead code from net/socket.c Jan Kiszka
2010-05-14 20:32   ` Miguel Di Ciurcio Filho
2010-05-17  7:23     ` Jan Kiszka

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=1273855231-22835-1-git-send-email-miguel.filho@gmail.com \
    --to=miguel.filho@gmail.com \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).