aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tftp/tftp.c
diff options
context:
space:
mode:
authorGavin Atkinson <gavin@FreeBSD.org>2010-06-27 14:21:08 +0000
committerGavin Atkinson <gavin@FreeBSD.org>2010-06-27 14:21:08 +0000
commitc54da67276f31cdc6657773fb68f9ee78e454ba9 (patch)
tree00a8a2e2de4464dc45263144581c5dc17c6116ae /usr.bin/tftp/tftp.c
parenta1ec94b88d3db03ca744027b8281ffcbff7c22f0 (diff)
downloadsrc-c54da67276f31cdc6657773fb68f9ee78e454ba9.tar.gz
src-c54da67276f31cdc6657773fb68f9ee78e454ba9.zip
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
Notes
Notes: svn path=/head/; revision=209551
Diffstat (limited to 'usr.bin/tftp/tftp.c')
-rw-r--r--usr.bin/tftp/tftp.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
index c6e111805977..f0c01039d982 100644
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -75,7 +75,6 @@ xmitfile(int peer, char *port, int fd, char *name, char *mode)
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, char *name, char *mode)
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, char *name, char *mode)
return;
}
- stats_init(&tftp_stats);
-
/*
* If the first packet is an OACK packet instead of an DATA packet,
* handle it different.