[mod.sources] v08i084: Multivol, Patch #1

sources-request@munnari.UUCP (02/28/87)

Submitted by: "Tony O'Hagan" <tony@uqcspe.oz.au>
Mod.sources: Volume 8, Issue 84
Archive-name: multivol.pch

	[ You may detect from reading this message that its been in the
	  queue for some time.  It has.  Sorry about that, there were
	  several causes, not worth going into here.

	  The diff as sent to me culdn't be applied by patch, for reasons
	  I couldn't be bothered finding out.  It was easier to apply the
	  patch manually, and then make a new diff for this posting.  .. kre ]

System: multivol
Patch #: 1
Priority: HIGH
Subject: Crucial fix, without this, multivol output can be garbage
From: "Tony O'Hagan" <tony@uqcspe.oz.au>

Description:
  You may have read a note in comp.unix.wizards from a multivol user
  mentioning a small fix to wr.c, I asked him for the diff which follows.
  It's the sort of bug that would make any existing multivol output prone to
  error. (i.e. don't trust it)   Thanks to seismo!uwvax!prairie!dan .

	Merry Christmas,
	Tony O'Hagan			tony@uqcspe.oz
  ==============================================================================
  Tony O'Hagan		Australia: (07) 3774125  International: +61 7 3774125
  University of Queensland	CSNET:	tony@uqcspe.oz	ACSnet:	tony@uqcspe.oz
  Dept. of Computer Science	UUCP:	...!seismo!munnari!uqcspe.oz!tony
  St. Lucia, Brisbane, 		ARPA:	tony%uqcspe.oz@seismo.css.gov
  AUSTRALIA  4067	 		JANET:	uqcspe.oz!tony@ukc
  ==============================================================================

Index: wr.c
*** /tmp/,RCSt1025278	Thu Dec 18 13:36:32 1986
--- wr.c	Thu Dec 18 13:28:12 1986
***************
*** 151,159
  		blk_len = blk_siz;	/* write at most blk_siz chars */
  
  	bhd_ptr = (blk_hdr *) blk_ptr;
  
! 	sprintf(len_str, "%6ld", blk_len);
  	strncpy(bhd_ptr->bh_dtalen, len_str, BSZDIG);
  
  	if (blk_len < blk_siz) {
  		/* move nulls to end of last block of last volume */

--- 151,165 -----
  		blk_len = blk_siz;	/* write at most blk_siz chars */
  
  	bhd_ptr = (blk_hdr *) blk_ptr;
  
! 	/* From: seismo!uwvax!prairie!dan			*/
! 	/* The following was changed by dmf.  The block length	*/
! 	/* was originally right-justified in the field, and if	*/
! 	/* it was follwed by a numeric character, the sscanf in	*/
! 	/* the read block code happily kept reading, leading to	*/
! 	/* odd block sizes.  This should fix that.		*/
!   	sprintf(len_str, "%-6ld", blk_len);
  	strncpy(bhd_ptr->bh_dtalen, len_str, BSZDIG);
  
  	if (blk_len < blk_siz) {
  		/* move nulls to end of last block of last volume */