diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-11-21 19:36:05 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-11-21 19:36:05 +0000 |
commit | 70207ab18d1da41062d1527b0c5af927514b001f (patch) | |
tree | ca854293a98114ef0508586dc6c722d36a040724 /usr.sbin/mtree | |
parent | 8672a91409f46bf49aed6ee27e4ad5bc514e09fa (diff) |
Use the same ordering when verifying as with creating and replace
some hardcoded constants with symbolic ones. Noted by Ed Wandasiewicz
in PR 3991.
ok deraadt@ millert@
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r-- | usr.sbin/mtree/compare.c | 8 | ||||
-rw-r--r-- | usr.sbin/mtree/create.c | 11 | ||||
-rw-r--r-- | usr.sbin/mtree/extern.h | 3 | ||||
-rw-r--r-- | usr.sbin/mtree/verify.c | 6 |
4 files changed, 14 insertions, 14 deletions
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c index 4492126250d..cac8e967cad 100644 --- a/usr.sbin/mtree/compare.c +++ b/usr.sbin/mtree/compare.c @@ -1,5 +1,5 @@ /* $NetBSD: compare.c,v 1.11 1996/09/05 09:56:48 mycroft Exp $ */ -/* $OpenBSD: compare.c,v 1.19 2004/08/01 18:32:20 deraadt Exp $ */ +/* $OpenBSD: compare.c,v 1.20 2004/11/21 19:36:04 otto Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -34,7 +34,7 @@ #if 0 static const char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: compare.c,v 1.19 2004/08/01 18:32:20 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: compare.c,v 1.20 2004/11/21 19:36:04 otto Exp $"; #endif #endif /* not lint */ @@ -264,7 +264,7 @@ typeerr: LABEL; } } if (s->flags & F_RMD160) { - char *new_digest, buf[41]; + char *new_digest, buf[RMD160_DIGEST_STRING_LENGTH]; new_digest = RMD160File(p->fts_accpath, buf); if (!new_digest) { @@ -280,7 +280,7 @@ typeerr: LABEL; } } if (s->flags & F_SHA1) { - char *new_digest, buf[41]; + char *new_digest, buf[SHA1_DIGEST_STRING_LENGTH]; new_digest = SHA1File(p->fts_accpath, buf); if (!new_digest) { diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c index 04f42ff20b6..5e86da1a0dd 100644 --- a/usr.sbin/mtree/create.c +++ b/usr.sbin/mtree/create.c @@ -1,5 +1,5 @@ /* $NetBSD: create.c,v 1.11 1996/09/05 09:24:19 mycroft Exp $ */ -/* $OpenBSD: create.c,v 1.23 2004/08/01 18:32:20 deraadt Exp $ */ +/* $OpenBSD: create.c,v 1.24 2004/11/21 19:36:04 otto Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -34,7 +34,7 @@ #if 0 static const char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: create.c,v 1.23 2004/08/01 18:32:20 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: create.c,v 1.24 2004/11/21 19:36:04 otto Exp $"; #endif #endif /* not lint */ @@ -70,7 +70,6 @@ static gid_t gid; static uid_t uid; static mode_t mode; -static int dsort(const FTSENT **, const FTSENT **); static void output(int, int *, const char *, ...); static int statd(FTS *, FTSENT *, uid_t *, gid_t *, mode_t *); static void statf(int, FTSENT *); @@ -213,7 +212,7 @@ statf(int indent, FTSENT *p) output(indent, &offset, "md5digest=%s", md5digest); } if (keys & F_RMD160 && S_ISREG(p->fts_statp->st_mode)) { - char *rmd160digest, buf[41]; + char *rmd160digest, buf[RMD160_DIGEST_STRING_LENGTH]; rmd160digest = RMD160File(p->fts_accpath,buf); if (!rmd160digest) @@ -222,7 +221,7 @@ statf(int indent, FTSENT *p) output(indent, &offset, "rmd160digest=%s", rmd160digest); } if (keys & F_SHA1 && S_ISREG(p->fts_statp->st_mode)) { - char *sha1digest, buf[41]; + char *sha1digest, buf[SHA1_DIGEST_STRING_LENGTH]; sha1digest = SHA1File(p->fts_accpath,buf); if (!sha1digest) @@ -351,7 +350,7 @@ statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode) return (0); } -static int +int dsort(const FTSENT **a, const FTSENT **b) { if (S_ISDIR((*a)->fts_statp->st_mode)) { diff --git a/usr.sbin/mtree/extern.h b/usr.sbin/mtree/extern.h index b3644e75d25..4954adb6749 100644 --- a/usr.sbin/mtree/extern.h +++ b/usr.sbin/mtree/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.6 2004/05/02 17:55:53 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.7 2004/11/21 19:36:04 otto Exp $ */ /* $NetBSD: extern.h,v 1.3 1995/03/07 21:12:07 cgd Exp $ */ /*- @@ -36,6 +36,7 @@ struct _node; struct _ftsent; int compare(char *, struct _node *, struct _ftsent *); +int dsort(const struct _ftsent **, const struct _ftsent **); int crc(int, u_int32_t *, u_int32_t *); void cwalk(void); void error(const char *, ...); diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c index 73f511e07a9..d6cac59dd70 100644 --- a/usr.sbin/mtree/verify.c +++ b/usr.sbin/mtree/verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verify.c,v 1.15 2004/08/01 18:32:20 deraadt Exp $ */ +/* $OpenBSD: verify.c,v 1.16 2004/11/21 19:36:04 otto Exp $ */ /* $NetBSD: verify.c,v 1.10 1995/03/07 21:26:28 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static const char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: verify.c,v 1.15 2004/08/01 18:32:20 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: verify.c,v 1.16 2004/11/21 19:36:04 otto Exp $"; #endif #endif /* not lint */ @@ -82,7 +82,7 @@ vwalk(void) argv[0] = "."; argv[1] = NULL; - if ((t = fts_open(argv, ftsoptions, NULL)) == NULL) + if ((t = fts_open(argv, ftsoptions, dsort)) == NULL) error("fts_open: %s", strerror(errno)); level = root; specdepth = rval = 0; |