Date: Sun, 27 Jun 2010 14:21:08 +0000 (UTC) From: Gavin Atkinson <gavin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r209551 - head/usr.bin/tftp Message-ID: <201006271421.o5REL8ld009591@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gavin Date: Sun Jun 27 14:21:08 2010 New Revision: 209551 URL: http://svn.freebsd.org/changeset/base/209551 Log: Fix transfer statistics in the "send file" case - The conditional used to print the stats were using an uninitialised variable. [1] Fix trasnfer statistics in the "receive file" case - the statistics struct was being cleared both before and after the initial connect to the remote server. As a result, the printed time and calculated bandwidth covers the time to connect ad well as the time to transfer the file. This may not be ideal, but now at least matches the "send file" case. Found by: clang static analyser [1] Reviewed by: imp Modified: head/usr.bin/tftp/tftp.c Modified: head/usr.bin/tftp/tftp.c ============================================================================== --- head/usr.bin/tftp/tftp.c Sun Jun 27 14:11:03 2010 (r209550) +++ head/usr.bin/tftp/tftp.c Sun Jun 27 14:21:08 2010 (r209551) @@ -75,7 +75,6 @@ xmitfile(int peer, char *port, int fd, c struct tftphdr *rp; int n, i; uint16_t block; - uint32_t amount; struct sockaddr_storage serv; /* valid server port number */ char recvbuffer[MAXPKTSIZE]; struct tftp_stats tftp_stats; @@ -162,7 +161,7 @@ xmitfile(int peer, char *port, int fd, c tftp_send(peer, &block, &tftp_stats); read_close(); - if (amount > 0) + if (tftp_stats.amount > 0) printstats("Sent", verbose, &tftp_stats); txrx_error = 1; @@ -243,8 +242,6 @@ recvfile(int peer, char *port, int fd, c return; } - stats_init(&tftp_stats); - /* * If the first packet is an OACK packet instead of an DATA packet, * handle it different.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006271421.o5REL8ld009591>