From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49628 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCxw8-0003M8-Rk for qemu-devel@nongnu.org; Fri, 14 May 2010 12:40:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCxw7-0004rf-0U for qemu-devel@nongnu.org; Fri, 14 May 2010 12:40:32 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:61639) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCxw6-0004pt-Oa for qemu-devel@nongnu.org; Fri, 14 May 2010 12:40:30 -0400 Received: by mail-gw0-f45.google.com with SMTP id 17so227593gwj.4 for ; Fri, 14 May 2010 09:40:30 -0700 (PDT) From: Miguel Di Ciurcio Filho Date: Fri, 14 May 2010 13:40:31 -0300 Message-Id: <1273855231-22835-1-git-send-email-miguel.filho@gmail.com> Subject: [Qemu-devel] [PATCH] net: Remove dead code from net/socket.c List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@linux.vnet.ibm.com, Miguel Di Ciurcio Filho 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 --- 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