Reads on raw disks are only guarranteed in multiples of the block size

This commit is contained in:
ws 1994-06-29 11:01:35 +00:00
parent 9bc624e44c
commit f455a4ed05
4 changed files with 12 additions and 10 deletions

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)pass1.c 8.1 (Berkeley) 6/5/93";*/
static char *rcsid = "$Id: pass1.c,v 1.8 1994/06/14 22:50:48 mycroft Exp $";
static char *rcsid = "$Id: pass1.c,v 1.9 1994/06/29 11:01:35 ws Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -96,7 +96,7 @@ checkinode(inumber, idesc)
struct zlncnt *zlnp;
int ndb, j;
mode_t mode;
char symbuf[MAXSYMLINKLEN];
char *symbuf;
dp = getnextinode(inumber);
mode = dp->di_mode & IFMT;
@ -149,9 +149,10 @@ checkinode(inumber, idesc)
if (doinglevel2 &&
dp->di_size > 0 && dp->di_size < MAXSYMLINKLEN &&
dp->di_blocks != 0) {
symbuf = alloca(secsize);
if (bread(fsreadfd, symbuf,
fsbtodb(&sblock, dp->di_db[0]),
(long)dp->di_size) != 0)
(long)secsize) != 0)
errexit("cannot read symlink");
if (debug) {
symbuf[dp->di_size] = 0;

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)setup.c 8.2 (Berkeley) 2/21/94";*/
static char *rcsid = "$Id: setup.c,v 1.10 1994/06/08 19:00:32 mycroft Exp $";
static char *rcsid = "$Id: setup.c,v 1.11 1994/06/29 11:01:37 ws Exp $";
#endif /* not lint */
#define DKTYPENAMES
@ -223,7 +223,7 @@ setup(dev)
sbdirty();
dirty(&asblk);
}
if (asblk.b_dirty) {
if (asblk.b_dirty && !bflag) {
bcopy((char *)&sblock, (char *)&altsblock,
(size_t)sblock.fs_sbsize);
flush(fswritefd, &asblk);

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)pass1.c 8.1 (Berkeley) 6/5/93";*/
static char *rcsid = "$Id: pass1.c,v 1.8 1994/06/14 22:50:48 mycroft Exp $";
static char *rcsid = "$Id: pass1.c,v 1.9 1994/06/29 11:01:35 ws Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -96,7 +96,7 @@ checkinode(inumber, idesc)
struct zlncnt *zlnp;
int ndb, j;
mode_t mode;
char symbuf[MAXSYMLINKLEN];
char *symbuf;
dp = getnextinode(inumber);
mode = dp->di_mode & IFMT;
@ -149,9 +149,10 @@ checkinode(inumber, idesc)
if (doinglevel2 &&
dp->di_size > 0 && dp->di_size < MAXSYMLINKLEN &&
dp->di_blocks != 0) {
symbuf = alloca(secsize);
if (bread(fsreadfd, symbuf,
fsbtodb(&sblock, dp->di_db[0]),
(long)dp->di_size) != 0)
(long)secsize) != 0)
errexit("cannot read symlink");
if (debug) {
symbuf[dp->di_size] = 0;

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)setup.c 8.2 (Berkeley) 2/21/94";*/
static char *rcsid = "$Id: setup.c,v 1.10 1994/06/08 19:00:32 mycroft Exp $";
static char *rcsid = "$Id: setup.c,v 1.11 1994/06/29 11:01:37 ws Exp $";
#endif /* not lint */
#define DKTYPENAMES
@ -223,7 +223,7 @@ setup(dev)
sbdirty();
dirty(&asblk);
}
if (asblk.b_dirty) {
if (asblk.b_dirty && !bflag) {
bcopy((char *)&sblock, (char *)&altsblock,
(size_t)sblock.fs_sbsize);
flush(fswritefd, &asblk);