[comp.bugs.4bsd] infinite loop in ftp

tas@mcnc.UUCP (02/28/87)

Index:	ucb/ftp/main.c 4.3BSD

Description:
	Ftp goes into an infinite loop on a stdin error.

Repeat-By:
	Start an ftp transfer of a large file, put the ftp
	process in the background, log out. Log back in,
	wait until the file transfer is complete, note the ftp
	process hanging around eating up cpu time. Logging out
	causes subsequent stdin reads by ftp to fail, but ftp
	ignores the errors, so when it's done with the file transfer
	and goes back into the command loop, it goes into a tight loop
	trying to read a dead stdin.

Fix:
	212c212
	< 			if (feof(stdin))
	---
	> 			if (feof(stdin) || ferror(stdin))