🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Bruce Robertson Wed, 26 Mar 1986 06:15
Bug in cpio with multiple `reels', FIX
#284
Author: Bruce Robertson
Date: Wed, 26 Mar 1986 06:15
41 lines
1893 bytes
Description:
	There is a bug in cpio that causes it to do strange things, usually
	either a core dump or an infinite loop, when you reach the 17th
	`reel' of a multiple reel cpio file, such as with floppies.

Repeat-By:
	Just do a directory listing, cpio -itvB, of a cpio file occupying
	more than 17 `reels'.

Fix:
	The problem is that cpio opens /dev/tty to prompt the user for
	a new input file name, and never bothers to close it.  Also, it
	never checks to see if the open succeeded, resulting in a call
	to fgets() with a null FILE pointer.  This is what causes the
	infinite loop and/or core dump.  Here's the fix:

*** /usr/src/cmd/cpio.c-old	Tue Mar 25 22:09:48 1986
--- /usr/src/cmd/cpio.c		Tue Mar 25 22:09:53 1986
***************
*** 1173,1178
  	fprintf(stderr,"If you want to go on, type device/file name when ready\n");
  	devtty = fopen("/dev/tty", "r");
  	fgets(str, 20, devtty);
  	str[strlen(str) - 1] = '\0';
  	if(!*str)
  		exit(2);

--- 1176,1182 -----
  	fprintf(stderr,"If you want to go on, type device/file name when ready\n");
  	devtty = fopen("/dev/tty", "r");
  	fgets(str, 20, devtty);
+ 	fclose(devtty);
  	str[strlen(str) - 1] = '\0';
  	if(!*str)
  		exit(2);
-- 

	Bruce Robertson
	UUCP: cbosgd!utah-cs!utah-gr!stride!bruce
	ARPA: stride!bruce@utah-gr.arpa
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads