Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jan 2010 13:48:58 +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: r201429 - head/usr.bin/tftp
Message-ID:  <201001031348.o03DmwLW033823@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gavin
Date: Sun Jan  3 13:48:58 2010
New Revision: 201429
URL: http://svn.freebsd.org/changeset/base/201429

Log:
  Fix return code in the case of successful file transfer, broken in
  tftp.c 1.13
  
  PR:		bin/117452
  Submitted by:	Spencer Minear  minear securecomputing.com
  Approved by:	ed (mentor)
  MFC after:	2 weeks

Modified:
  head/usr.bin/tftp/tftp.c

Modified: head/usr.bin/tftp/tftp.c
==============================================================================
--- head/usr.bin/tftp/tftp.c	Sun Jan  3 12:50:27 2010	(r201428)
+++ head/usr.bin/tftp/tftp.c	Sun Jan  3 13:48:58 2010	(r201429)
@@ -140,6 +140,7 @@ send_data:
 		    (struct sockaddr *)&peer, peer.ss_len);
 		if (n != size + 4) {
 			warn("sendto");
+			txrx_error = 1;
 			goto abort;
 		}
 		read_ahead(file, convert);
@@ -153,6 +154,7 @@ send_data:
 			alarm(0);
 			if (n < 0) {
 				warn("recvfrom");
+				txrx_error = 1;
 				goto abort;
 			}
 			if (!serv.ss_family)
@@ -160,6 +162,7 @@ send_data:
 			else if (!cmpport((struct sockaddr *)&serv,
 			    (struct sockaddr *)&from)) {
 				warn("server port mismatch");
+				txrx_error = 1;
 				goto abort;
 			}
 			peer = from;
@@ -202,7 +205,6 @@ abort:
 	stopclock();
 	if (amount > 0)
 		printstats("Sent", amount);
-	txrx_error = 1;
 }
 
 /*
@@ -255,6 +257,7 @@ send_ack:
 		    peer.ss_len) != size) {
 			alarm(0);
 			warn("sendto");
+			txrx_error = 1;
 			goto abort;
 		}
 		write_behind(file, convert);
@@ -268,6 +271,7 @@ send_ack:
 			alarm(0);
 			if (n < 0) {
 				warn("recvfrom");
+				txrx_error = 1;
 				goto abort;
 			}
 			if (!serv.ss_family)
@@ -275,6 +279,7 @@ send_ack:
 			else if (!cmpport((struct sockaddr *)&serv,
 			    (struct sockaddr *)&from)) {
 				warn("server port mismatch");
+				txrx_error = 1;
 				goto abort;
 			}
 			peer = from;
@@ -325,7 +330,6 @@ abort:						/* ok to ack, since user */
 	stopclock();
 	if (amount > 0)
 		printstats("Received", amount);
-	txrx_error = 1;
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001031348.o03DmwLW033823>