diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-07-01 11:04:59 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-07-01 11:04:59 +0000 |
commit | d24b399a98c283d9d37ccf2e609c9371802b6bce (patch) | |
tree | f97fa879c8205ba28173a70bfe4ddc77bd3541f0 /libexec/lfs_cleanerd/print.c | |
parent | 5a65ce12ba98d20b3a1e19f9985501098037cd57 (diff) |
new lfs_cleanerd from Lite2.
Diffstat (limited to 'libexec/lfs_cleanerd/print.c')
-rw-r--r-- | libexec/lfs_cleanerd/print.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/libexec/lfs_cleanerd/print.c b/libexec/lfs_cleanerd/print.c index 16aee876dab..9aacedef429 100644 --- a/libexec/lfs_cleanerd/print.c +++ b/libexec/lfs_cleanerd/print.c @@ -1,3 +1,5 @@ +/* $OpenBSD: print.c,v 1.2 1996/07/01 11:04:58 downsj Exp $ */ + /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -32,8 +34,8 @@ */ #ifndef lint -/*static char sccsid[] = "from: @(#)print.c 8.1 (Berkeley) 6/4/93";*/ -static char *rcsid = "$Id: print.c,v 1.1 1995/10/18 08:43:19 deraadt Exp $"; +/*static char sccsid[] = "@(#)print.c 8.2 (Berkeley) 5/24/95";*/ +static char rcsid[] = "$OpenBSD: print.c,v 1.2 1996/07/01 11:04:58 downsj Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -66,22 +68,32 @@ dump_summary(lfsp, sp, flags, iaddrp) FINFO *fp; int ck; + if (sp->ss_magic != SS_MAGIC) + return(-1); + if (sp->ss_sumsum != (ck = cksum(&sp->ss_datasum, LFS_SUMMARY_SIZE - sizeof(sp->ss_sumsum)))) return(-1); + numblocks = (sp->ss_ninos + INOPB(lfsp) - 1) / INOPB(lfsp); + + /* Do some basic sanity checking. */ + if (sp->ss_nfinfo > LFS_SUMMARY_SIZE / sizeof(FINFO) || + numblocks > lfsp->lfs_ssize || + numblocks > LFS_SUMMARY_SIZE / sizeof(daddr_t)) + return(-1); + if (flags & DUMP_SUM_HEADER) { - (void)printf(" %s0x%X\t%s%d\t%s%d\n %s0x%X\t%s0x%X", + (void)printf(" %s0x%X\t%s%d\t%s%d\n %s0x%X\t%s0x%X\t%s0x%X\n", "next ", sp->ss_next, "nfinfo ", sp->ss_nfinfo, "ninos ", sp->ss_ninos, "sumsum ", sp->ss_sumsum, - "datasum ", sp->ss_datasum ); - (void)printf("\tcreate %s", ctime((time_t *)&sp->ss_create)); + "datasum ", sp->ss_datasum, + "magic ", sp->ss_magic); + (void)printf(" create %s", ctime((time_t *)&sp->ss_create)); } - numblocks = (sp->ss_ninos + INOPB(lfsp) - 1) / INOPB(lfsp); - /* Dump out inode disk addresses */ if (flags & DUMP_INODE_ADDRS) printf(" Inode addresses:"); @@ -162,13 +174,13 @@ dump_super(lfsp) "cleansz ", lfsp->lfs_cleansz, "segtabsz ", lfsp->lfs_segtabsz); - (void)printf("%s0x%X\t%s%d\t%s0x%X\t%s%d\n", + (void)printf("%s0x%X\t%s%d\t%s0x%qX\t%s%d\n", "segmask ", lfsp->lfs_segmask, "segshift ", lfsp->lfs_segshift, "bmask ", lfsp->lfs_bmask, "bshift ", lfsp->lfs_bshift); - (void)printf("%s0x%X\t\t%s%d\t%s0x%X\t%s%d\n", + (void)printf("%s0x%qX\t\t%s%d\t%s0x%qX\t%s%d\n", "ffmask ", lfsp->lfs_ffmask, "ffshift ", lfsp->lfs_ffshift, "fbmask ", lfsp->lfs_fbmask, |