Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/mtree more const



details:   https://anonhg.NetBSD.org/src/rev/1c5931418e19
branches:  trunk
changeset: 781868:1c5931418e19
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 05 00:41:24 2012 +0000

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

diffstat:

 usr.sbin/mtree/compare.c |   6 ++++--
 usr.sbin/mtree/create.c  |  10 ++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diffs (85 lines):

diff -r c028538f90df -r 1c5931418e19 usr.sbin/mtree/compare.c
--- a/usr.sbin/mtree/compare.c  Fri Oct 05 00:40:51 2012 +0000
+++ b/usr.sbin/mtree/compare.c  Fri Oct 05 00:41:24 2012 +0000
@@ -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 @@
                        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 @@
                        free(digestbuf);
                }
        }
+#endif
        if (s->flags & F_SHA512) {
                if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) {
                        LABEL;
diff -r c028538f90df -r 1c5931418e19 usr.sbin/mtree/create.c
--- a/usr.sbin/mtree/create.c   Fri Oct 05 00:40:51 2012 +0000
+++ b/usr.sbin/mtree/create.c   Fri Oct 05 00:41:24 2012 +0000
@@ -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 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 @@
                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 @@
  * 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)) {



Home | Main Index | Thread Index | Old Index