Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site unmvax.UUCP
Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!sdcrdcf!hplabs!hao!seismo!cmcl2!lanl-a!unm-cvax!unmvax!lee
From: lee@unmvax.UUCP
Newsgroups: net.bugs.4bsd
Subject: 4.2 tftp goes into an infinite loop on EOF (fix)
Message-ID: <450@unmvax.UUCP>
Date: Thu, 27-Sep-84 19:04:18 EDT
Article-I.D.: unmvax.450
Posted: Thu Sep 27 19:04:18 1984
Date-Received: Sun, 30-Sep-84 04:55:17 EDT
Distribution: net
Organization: Univ. of New Mexico, Albuquerque
Lines: 59

Subject: tftp will go into an infinite loop if given the EOF character
Index:	/usr/ucb/tftp 4.2BSD (fix)

Description:
	See subject line

Repeat-By:
	Get into tftp
	Type ^D or whatever your EOF character is.
	Watch the fun!

Fix:
	Make the following changes to .../src/ucb/tftp/main.c

RCS file: RCS/main.c,v
retrieving revision 1.1
diff -c -r1.1 main.c
*** /tmp/,RCSt1013708	Thu Sep 27 16:58:43 1984
--- main.c	Thu Sep 27 16:58:08 1984
***************
*** 457,463
  		putchar('\n');
  	for (;;) {
  		printf("%s> ", prompt);
! 		if (gets(line) == 0)
  			continue;
  		if (line[0] == 0)
  			continue;

--- 457,465 -----
  		putchar('\n');
  	for (;;) {
  		printf("%s> ", prompt);
! 		if (gets(line) == 0) {
! 			clearerr(stdin);
! 			putchar('\n');
  			continue;
  		}
  		if (line[0] == 0)
***************
*** 459,464
  		printf("%s> ", prompt);
  		if (gets(line) == 0)
  			continue;
  		if (line[0] == 0)
  			continue;
  		makeargv();

--- 461,467 -----
  			clearerr(stdin);
  			putchar('\n');
  			continue;
+ 		}
  		if (line[0] == 0)
  			continue;
  		makeargv();
-- 
			--Lee (Ward)
			{ucbvax,convex,gatech,pur-ee}!unmvax!lee