Module Name:    src
Committed By:   christos
Date:           Fri Oct  5 00:41:24 UTC 2012

Modified Files:
        src/usr.sbin/mtree: compare.c create.c

Log Message:
more const
check if we support SHA384 before using
(brooks)


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/mtree/compare.c
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/mtree/create.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/mtree/compare.c
diff -u src/usr.sbin/mtree/compare.c:1.52 src/usr.sbin/mtree/compare.c:1.53
--- src/usr.sbin/mtree/compare.c:1.52	Sun Dec 28 14:36:30 2008
+++ src/usr.sbin/mtree/compare.c	Thu Oct  4 20:41:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: compare.c,v 1.52 2008/12/28 19:36:30 christos Exp $	*/
+/*	$NetBSD: compare.c,v 1.53 2012/10/05 00:41:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)compare.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: compare.c,v 1.52 2008/12/28 19:36:30 christos Exp $");
+__RCSID("$NetBSD: compare.c,v 1.53 2012/10/05 00:41:24 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -462,6 +462,7 @@ typeerr:		LABEL;
 			free(digestbuf);
 		}
 	}
+#ifdef SHA384_BLOCK_LENGTH
 	if (s->flags & F_SHA384) {
 		if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) {
 			LABEL;
@@ -478,6 +479,7 @@ typeerr:		LABEL;
 			free(digestbuf);
 		}
 	}
+#endif
 	if (s->flags & F_SHA512) {
 		if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) {
 			LABEL;

Index: src/usr.sbin/mtree/create.c
diff -u src/usr.sbin/mtree/create.c:1.59 src/usr.sbin/mtree/create.c:1.60
--- src/usr.sbin/mtree/create.c:1.59	Sun Jul 15 05:08:29 2012
+++ src/usr.sbin/mtree/create.c	Thu Oct  4 20:41:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: create.c,v 1.59 2012/07/15 09:08:29 spz Exp $	*/
+/*	$NetBSD: create.c,v 1.60 2012/10/05 00:41:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)create.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: create.c,v 1.59 2012/07/15 09:08:29 spz Exp $");
+__RCSID("$NetBSD: create.c,v 1.60 2012/10/05 00:41:24 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -83,7 +83,7 @@ static uid_t uid;
 static mode_t mode;
 static u_long flags;
 
-static int	dcmp(const FTSENT **, const FTSENT **);
+static int	dcmp(const FTSENT *const *, const FTSENT *const *);
 static void	output(int *, const char *, ...)
 	__attribute__((__format__(__printf__, 2, 3)));
 static int	statd(FTS *, FTSENT *, uid_t *, gid_t *, mode_t *, u_long *);
@@ -242,12 +242,14 @@ statf(FTSENT *p)
 		output(&indent, "sha256=%s", digestbuf);
 		free(digestbuf);
 	}
+#ifdef SHA384_BLOCK_LENGTH
 	if (keys & F_SHA384 && S_ISREG(p->fts_statp->st_mode)) {
 		if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL)
 			mtree_err("%s: SHA384_File failed: %s", p->fts_accpath, strerror(errno));
 		output(&indent, "sha384=%s", digestbuf);
 		free(digestbuf);
 	}
+#endif
 	if (keys & F_SHA512 && S_ISREG(p->fts_statp->st_mode)) {
 		if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL)
 			mtree_err("%s: SHA512_File failed: %s", p->fts_accpath, strerror(errno));
@@ -398,7 +400,7 @@ statd(FTS *t, FTSENT *parent, uid_t *pui
  * Keep this in sync with nodecmp() in spec.c.
  */
 static int
-dcmp(const FTSENT **a, const FTSENT **b)
+dcmp(const FTSENT *const *a, const FTSENT *const *b)
 {
 
 	if (S_ISDIR((*a)->fts_statp->st_mode)) {

Reply via email to