When initializing 'fssize,' the size of the data buffer to be used when

writing data to the file system, if the "optimal" file system I/O
operation block size is less than TP_BSIZE, leave fssize alone (i.e.
at its default setting of MAXBSIZE).  This was causing restore's
stack to be trashed, because the end-of-buffer checking/flushing code
around line 680 would never notice that the buffer was full (because
it'd be comparing a buffer segment index, which would always be >= 1, to
fssize / TP_BSIZE, which could be zero in that case), and would keep
filling and filling and filling...
This commit is contained in:
cgd 1996-11-30 18:31:29 +00:00
parent a0c5caa042
commit bcaa5b7b1c
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tape.c,v 1.21 1996/11/30 18:04:48 cgd Exp $ */
/* $NetBSD: tape.c,v 1.22 1996/11/30 18:31:29 cgd Exp $ */
/*
* Copyright (c) 1983, 1993
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)tape.c 8.6 (Berkeley) 9/13/94";
#else
static char rcsid[] = "$NetBSD: tape.c,v 1.21 1996/11/30 18:04:48 cgd Exp $";
static char rcsid[] = "$NetBSD: tape.c,v 1.22 1996/11/30 18:31:29 cgd Exp $";
#endif
#endif /* not lint */
@ -236,7 +236,7 @@ setup()
fprintf(stderr, "cannot stat .: %s\n", strerror(errno));
exit(1);
}
if (stbuf.st_blksize > 0 && stbuf.st_blksize <= MAXBSIZE)
if (stbuf.st_blksize >= TP_BSIZE && stbuf.st_blksize <= MAXBSIZE)
fssize = stbuf.st_blksize;
if (((fssize - 1) & fssize) != 0) {
fprintf(stderr, "bad block size %d\n", fssize);