Reads on raw disks are only guarranteed in multiples of the block size
This commit is contained in:
parent
9bc624e44c
commit
f455a4ed05
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)pass1.c 8.1 (Berkeley) 6/5/93";*/
|
/*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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -96,7 +96,7 @@ checkinode(inumber, idesc)
|
||||||
struct zlncnt *zlnp;
|
struct zlncnt *zlnp;
|
||||||
int ndb, j;
|
int ndb, j;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
char symbuf[MAXSYMLINKLEN];
|
char *symbuf;
|
||||||
|
|
||||||
dp = getnextinode(inumber);
|
dp = getnextinode(inumber);
|
||||||
mode = dp->di_mode & IFMT;
|
mode = dp->di_mode & IFMT;
|
||||||
|
@ -149,9 +149,10 @@ checkinode(inumber, idesc)
|
||||||
if (doinglevel2 &&
|
if (doinglevel2 &&
|
||||||
dp->di_size > 0 && dp->di_size < MAXSYMLINKLEN &&
|
dp->di_size > 0 && dp->di_size < MAXSYMLINKLEN &&
|
||||||
dp->di_blocks != 0) {
|
dp->di_blocks != 0) {
|
||||||
|
symbuf = alloca(secsize);
|
||||||
if (bread(fsreadfd, symbuf,
|
if (bread(fsreadfd, symbuf,
|
||||||
fsbtodb(&sblock, dp->di_db[0]),
|
fsbtodb(&sblock, dp->di_db[0]),
|
||||||
(long)dp->di_size) != 0)
|
(long)secsize) != 0)
|
||||||
errexit("cannot read symlink");
|
errexit("cannot read symlink");
|
||||||
if (debug) {
|
if (debug) {
|
||||||
symbuf[dp->di_size] = 0;
|
symbuf[dp->di_size] = 0;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)setup.c 8.2 (Berkeley) 2/21/94";*/
|
/*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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#define DKTYPENAMES
|
#define DKTYPENAMES
|
||||||
|
@ -223,7 +223,7 @@ setup(dev)
|
||||||
sbdirty();
|
sbdirty();
|
||||||
dirty(&asblk);
|
dirty(&asblk);
|
||||||
}
|
}
|
||||||
if (asblk.b_dirty) {
|
if (asblk.b_dirty && !bflag) {
|
||||||
bcopy((char *)&sblock, (char *)&altsblock,
|
bcopy((char *)&sblock, (char *)&altsblock,
|
||||||
(size_t)sblock.fs_sbsize);
|
(size_t)sblock.fs_sbsize);
|
||||||
flush(fswritefd, &asblk);
|
flush(fswritefd, &asblk);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)pass1.c 8.1 (Berkeley) 6/5/93";*/
|
/*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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -96,7 +96,7 @@ checkinode(inumber, idesc)
|
||||||
struct zlncnt *zlnp;
|
struct zlncnt *zlnp;
|
||||||
int ndb, j;
|
int ndb, j;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
char symbuf[MAXSYMLINKLEN];
|
char *symbuf;
|
||||||
|
|
||||||
dp = getnextinode(inumber);
|
dp = getnextinode(inumber);
|
||||||
mode = dp->di_mode & IFMT;
|
mode = dp->di_mode & IFMT;
|
||||||
|
@ -149,9 +149,10 @@ checkinode(inumber, idesc)
|
||||||
if (doinglevel2 &&
|
if (doinglevel2 &&
|
||||||
dp->di_size > 0 && dp->di_size < MAXSYMLINKLEN &&
|
dp->di_size > 0 && dp->di_size < MAXSYMLINKLEN &&
|
||||||
dp->di_blocks != 0) {
|
dp->di_blocks != 0) {
|
||||||
|
symbuf = alloca(secsize);
|
||||||
if (bread(fsreadfd, symbuf,
|
if (bread(fsreadfd, symbuf,
|
||||||
fsbtodb(&sblock, dp->di_db[0]),
|
fsbtodb(&sblock, dp->di_db[0]),
|
||||||
(long)dp->di_size) != 0)
|
(long)secsize) != 0)
|
||||||
errexit("cannot read symlink");
|
errexit("cannot read symlink");
|
||||||
if (debug) {
|
if (debug) {
|
||||||
symbuf[dp->di_size] = 0;
|
symbuf[dp->di_size] = 0;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)setup.c 8.2 (Berkeley) 2/21/94";*/
|
/*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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#define DKTYPENAMES
|
#define DKTYPENAMES
|
||||||
|
@ -223,7 +223,7 @@ setup(dev)
|
||||||
sbdirty();
|
sbdirty();
|
||||||
dirty(&asblk);
|
dirty(&asblk);
|
||||||
}
|
}
|
||||||
if (asblk.b_dirty) {
|
if (asblk.b_dirty && !bflag) {
|
||||||
bcopy((char *)&sblock, (char *)&altsblock,
|
bcopy((char *)&sblock, (char *)&altsblock,
|
||||||
(size_t)sblock.fs_sbsize);
|
(size_t)sblock.fs_sbsize);
|
||||||
flush(fswritefd, &asblk);
|
flush(fswritefd, &asblk);
|
||||||
|
|
Loading…
Reference in New Issue