4.2 tftp goes into an infinite loop on EOF (fix)

lee at unmvax.UUCP lee at unmvax.UUCP
Fri Sep 28 09:04:18 AEST 1984


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



More information about the Comp.bugs.4bsd.ucb-fixes mailing list