[comp.sources.bugs] less A B >C dumps core

eggert@twinsun.com (Paul Eggert) (01/15/91)

The command

	less A B >C

dumps core if the files A and B are readable.  Here is a patch to less version
109 (plus previous patches already reported).  I tried to email this to less's
author, Mark Nudelman <convergent.com!UNIX386!mark>, but got no acknowledgment.


===================================================================
RCS file: RCS/main.c,v
retrieving revision 1.4
diff -c -r1.4 main.c
*** 1.4	1989/05/30 11:09:34
--- main.c	1991/01/03 20:42:50
***************
*** 136,142 ****
  		free(previous_file);
  	previous_file = current_file;
  	current_file = filename;
! 	if (previous_file != NULL)
  		prev_pos = position(TOP);
  	ispipe = (f == 0);
  	if (ispipe)
--- 136,142 ----
  		free(previous_file);
  	previous_file = current_file;
  	current_file = filename;
! 	if (previous_file != NULL && is_tty)
  		prev_pos = position(TOP);
  	ispipe = (f == 0);
  	if (ispipe)