Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Sep 2012 19:59:15 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r240706 - projects/mtree/contrib/mtree
Message-ID:  <201209191959.q8JJxFm0059291@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Wed Sep 19 19:59:15 2012
New Revision: 240706
URL: http://svn.freebsd.org/changeset/base/240706

Log:
  FreeBSD porting tweaks:
   - The compat function in fts_open takes (const FTSENT * const *) arguments
     in FreeBSD rather than the historic (const FTSENT **).
   - __dead is spelled __dead2 here.
   - Include sys/stat.h rather than picking it up via namespace polution.
   - Add a way to disable SHA384 since we don't have it.
   - Don't double declare the sflag extern.

Modified:
  projects/mtree/contrib/mtree/compare.c
  projects/mtree/contrib/mtree/crc.c
  projects/mtree/contrib/mtree/create.c
  projects/mtree/contrib/mtree/extern.h
  projects/mtree/contrib/mtree/mtree.c

Modified: projects/mtree/contrib/mtree/compare.c
==============================================================================
--- projects/mtree/contrib/mtree/compare.c	Wed Sep 19 19:22:24 2012	(r240705)
+++ projects/mtree/contrib/mtree/compare.c	Wed Sep 19 19:59:15 2012	(r240706)
@@ -43,6 +43,7 @@ __RCSID("$NetBSD: compare.c,v 1.52 2008/
 #endif /* not lint */
 
 #include <sys/param.h>
+#include <sys/stat.h>
 
 #include <errno.h>
 #include <fcntl.h>
@@ -462,6 +463,7 @@ typeerr:		LABEL;
 			free(digestbuf);
 		}
 	}
+#ifndef NO_SHA384
 	if (s->flags & F_SHA384) {
 		if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) {
 			LABEL;
@@ -478,6 +480,7 @@ typeerr:		LABEL;
 			free(digestbuf);
 		}
 	}
+#endif	/* ! NO_SHA384 */
 	if (s->flags & F_SHA512) {
 		if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) {
 			LABEL;

Modified: projects/mtree/contrib/mtree/crc.c
==============================================================================
--- projects/mtree/contrib/mtree/crc.c	Wed Sep 19 19:22:24 2012	(r240705)
+++ projects/mtree/contrib/mtree/crc.c	Wed Sep 19 19:59:15 2012	(r240706)
@@ -114,7 +114,6 @@ static const u_int32_t crctab[] = {
  * locations to store the crc and the number of bytes read.  It returns 0 on
  * success and 1 on failure.  Errno is set on failure.
  */
-extern int sflag;
 u_int32_t crc_total = ~0;		/* The crc over a number of files. */
 
 int

Modified: projects/mtree/contrib/mtree/create.c
==============================================================================
--- projects/mtree/contrib/mtree/create.c	Wed Sep 19 19:22:24 2012	(r240705)
+++ projects/mtree/contrib/mtree/create.c	Wed Sep 19 19:59:15 2012	(r240706)
@@ -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);
 	}
+#ifndef NO_SHA384
 	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)) {

Modified: projects/mtree/contrib/mtree/extern.h
==============================================================================
--- projects/mtree/contrib/mtree/extern.h	Wed Sep 19 19:22:24 2012	(r240705)
+++ projects/mtree/contrib/mtree/extern.h	Wed Sep 19 19:59:15 2012	(r240706)
@@ -60,7 +60,7 @@ void	 cwalk(void);
 void	 dump_nodes(const char *, NODE *, int);
 void	 init_excludes(void);
 int	 matchtags(NODE *);
-__dead __printflike(1,2) void	 mtree_err(const char *, ...);
+__dead2 __printflike(1,2) void	 mtree_err(const char *, ...);
 const char *nodetype(u_int);
 u_int	 parsekey(const char *, int *);
 void	 parsetags(slist_t *, char *);

Modified: projects/mtree/contrib/mtree/mtree.c
==============================================================================
--- projects/mtree/contrib/mtree/mtree.c	Wed Sep 19 19:22:24 2012	(r240705)
+++ projects/mtree/contrib/mtree/mtree.c	Wed Sep 19 19:59:15 2012	(r240706)
@@ -63,7 +63,7 @@ int	cflag, Cflag, dflag, Dflag, eflag, i
     	rflag, sflag, tflag, uflag, Uflag;
 char	fullpath[MAXPATHLEN];
 
-__dead static	void	usage(void);
+__dead2 static	void	usage(void);
 
 int
 main(int argc, char **argv)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209191959.q8JJxFm0059291>