[Midnightbsd-cvs] src [11092] trunk/sbin/restore: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Jun 19 14:06:50 EDT 2018


Revision: 11092
          http://svnweb.midnightbsd.org/src/?rev=11092
Author:   laffer1
Date:     2018-06-19 14:06:49 -0400 (Tue, 19 Jun 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/sbin/restore/Makefile
    trunk/sbin/restore/dirs.c
    trunk/sbin/restore/extern.h
    trunk/sbin/restore/interactive.c
    trunk/sbin/restore/main.c
    trunk/sbin/restore/restore.8
    trunk/sbin/restore/restore.c
    trunk/sbin/restore/restore.h
    trunk/sbin/restore/symtab.c
    trunk/sbin/restore/tape.c
    trunk/sbin/restore/utilities.c

Property Changed:
----------------
    trunk/sbin/restore/restore.8

Modified: trunk/sbin/restore/Makefile
===================================================================
--- trunk/sbin/restore/Makefile	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/Makefile	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.1 (Berkeley) 6/5/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/sbin/restore/Makefile 203155 2010-01-29 10:00:42Z jh $
 
 .PATH: ${.CURDIR}/../dump
 

Modified: trunk/sbin/restore/dirs.c
===================================================================
--- trunk/sbin/restore/dirs.c	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/dirs.c	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -37,7 +38,7 @@
 static char sccsid[] = "@(#)dirs.c	8.7 (Berkeley) 5/1/95";
 #endif
 static const char rcsid[] =
-  "$MidnightBSD$";
+  "$FreeBSD: stable/10/sbin/restore/dirs.c 299954 2016-05-16 16:29:56Z pfg $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -85,7 +86,7 @@
 	mode_t mode;
 	uid_t uid;
 	gid_t gid;
-	int flags;
+	u_int flags;
 	int extsize;
 };
 
@@ -115,8 +116,8 @@
 static void		 flushent(void);
 static struct inotab	*inotablookup(ino_t);
 static RST_DIR		*opendirfile(const char *);
-static void		 putdir(char *, long);
-static void		 putdirattrs(char *, long);
+static void		 putdir(char *, size_t);
+static void		 putdirattrs(char *, size_t);
 static void		 putent(struct direct *);
 static void		 rst_seekdir(RST_DIR *, long, long);
 static long		 rst_telldir(RST_DIR *);
@@ -323,10 +324,10 @@
  * Put the directory entries in the directory file
  */
 static void
-putdir(char *buf, long size)
+putdir(char *buf, size_t size)
 {
 	struct direct *dp;
-	long loc, i;
+	size_t loc, i;
 
 	for (loc = 0; loc < size; ) {
 		dp = (struct direct *)(buf + loc);
@@ -356,12 +357,12 @@
 				   "reclen not multiple of 4 ");
 			if (dp->d_reclen < DIRSIZ(0, dp))
 				vprintf(stdout,
-				   "reclen less than DIRSIZ (%d < %zu) ",
+				   "reclen less than DIRSIZ (%u < %zu) ",
 				   dp->d_reclen, DIRSIZ(0, dp));
 #if NAME_MAX < 255
 			if (dp->d_namlen > NAME_MAX)
 				vprintf(stdout,
-				   "reclen name too big (%d > %d) ",
+				   "reclen name too big (%u > %u) ",
 				   dp->d_namlen, NAME_MAX);
 #endif
 			vprintf(stdout, "\n");
@@ -418,7 +419,7 @@
  * Save extended attributes for a directory entry to a file.
  */
 static void
-putdirattrs(char *buf, long size)
+putdirattrs(char *buf, size_t size)
 {
 
 	if (mf != NULL && fwrite(buf, size, 1, mf) != 1)
@@ -637,7 +638,8 @@
 				continue;
 		}
 		if (ep == NULL) {
-			panic("cannot find directory inode %d\n", node.ino);
+			panic("cannot find directory inode %ju\n",
+			    (uintmax_t)node.ino);
 			continue;
 		}
 		cp = myname(ep);
@@ -678,7 +680,8 @@
 
 	itp = inotablookup(ino);
 	if (itp == NULL)
-		panic("Cannot find directory inode %d named %s\n", ino, name);
+		panic("Cannot find directory inode %ju named %s\n",
+		    (uintmax_t)ino, name);
 	if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) {
 		fprintf(stderr, "%s: ", name);
 		(void) fflush(stderr);
@@ -691,15 +694,15 @@
 		size = i < BUFSIZ ? i : BUFSIZ;
 		if (read(dp, buf, (int) size) == -1) {
 			fprintf(stderr,
-				"write error extracting inode %d, name %s\n",
-				curfile.ino, curfile.name);
+			    "write error extracting inode %ju, name %s\n",
+			    (uintmax_t)curfile.ino, curfile.name);
 			fprintf(stderr, "read: %s\n", strerror(errno));
 			done(1);
 		}
 		if (!Nflag && write(ofile, buf, (int) size) == -1) {
 			fprintf(stderr,
-				"write error extracting inode %d, name %s\n",
-				curfile.ino, curfile.name);
+			    "write error extracting inode %ju, name %s\n",
+			    (uintmax_t)curfile.ino, curfile.name);
 			fprintf(stderr, "write: %s\n", strerror(errno));
 			done(1);
 		}

Modified: trunk/sbin/restore/extern.h
===================================================================
--- trunk/sbin/restore/extern.h	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/extern.h	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -27,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)extern.h	8.2 (Berkeley) 1/7/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sbin/restore/extern.h 299954 2016-05-16 16:29:56Z pfg $
  */
 
 struct entry	*addentry(char *, ino_t, int);
@@ -54,8 +55,8 @@
 void		 freename(char *);
 int	 	 genliteraldir(char *, ino_t);
 char		*gentempname(struct entry *);
-void		 getfile(void (*)(char *, long), void (*)(char *, long),
-			void (*)(char *, long));
+void		 getfile(void (*)(char *, size_t), void (*)(char *, size_t),
+			void (*)(char *, size_t));
 void		 getvol(long);
 void		 initsymtable(char *);
 int	 	 inodetype(ino_t);
@@ -98,7 +99,7 @@
 void	 	 treescan(char *, ino_t, long (*)(char *, ino_t, int));
 ino_t		 upperbnd(ino_t);
 long		 verifyfile(char *, ino_t, int);
-void		 xtrnull(char *, long);
+void		 xtrnull(char *, size_t);
 
 /* From ../dump/dumprmt.c */
 void		rmtclose(void);

Modified: trunk/sbin/restore/interactive.c
===================================================================
--- trunk/sbin/restore/interactive.c	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/interactive.c	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1985, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +35,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/restore/interactive.c 241013 2012-09-27 23:31:06Z mdf $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -47,6 +48,7 @@
 #include <glob.h>
 #include <limits.h>
 #include <setjmp.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -675,7 +677,8 @@
 		for (j = 0; j < columns; j++) {
 			fp = &list[j * lines + i];
 			if (vflag) {
-				fprintf(stderr, "%*d ", precision, fp->fnum);
+				fprintf(stderr, "%*ju ",
+				    precision, (uintmax_t)fp->fnum);
 				fp->len += precision + 1;
 			}
 			if (haveprefix) {

Modified: trunk/sbin/restore/main.c
===================================================================
--- trunk/sbin/restore/main.c	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/main.c	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -40,7 +41,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/restore/main.c 299148 2016-05-06 01:37:06Z pfg $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -366,7 +367,8 @@
 	if (flags) {
 		*p = '\0';
 		*nargv++ = flagsp;
-	}
+	} else
+		free(flagsp);
 
 	/* Copy remaining arguments. */
 	while ((*nargv++ = *argv++));

Modified: trunk/sbin/restore/restore.8
===================================================================
--- trunk/sbin/restore/restore.8	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/restore.8	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)restore.8	8.4 (Berkeley) 5/1/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/sbin/restore/restore.8 235837 2012-05-23 15:06:13Z joel $
 .\"
 .Dd October 12, 2006
 .Dt RESTORE 8
@@ -68,16 +69,6 @@
 .Op Fl f Ar file | Fl P Ar pipecommand
 .Op Fl s Ar fileno
 .Op Ar
-.Pp
-.Nm rrestore
-is an alternate name for
-.Nm .
-.Pp
-.in \" XXX
-(The
-.Bx 4.3
-option syntax is implemented for backward compatibility, but
-is not documented here.)
 .Sh DESCRIPTION
 The
 .Nm
@@ -104,6 +95,14 @@
 the appearance of a directory name refers to
 the files and (recursively) subdirectories of that directory.
 .Pp
+.Nm
+may also be invoked as
+.Nm rrestore .
+The
+.Bx 4.3
+option syntax is implemented for backward compatibility, but
+is not documented here.
+.Pp
 Exactly one of the following flags is required:
 .Bl -tag -width Ds
 .It Fl i


Property changes on: trunk/sbin/restore/restore.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sbin/restore/restore.c
===================================================================
--- trunk/sbin/restore/restore.c	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/restore.c	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -34,11 +35,12 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/restore/restore.c 241013 2012-09-27 23:31:06Z mdf $");
 
 #include <sys/types.h>
 
 #include <limits.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -61,7 +63,7 @@
 	if (TSTINO(ino, dumpmap) == 0)
 		return (descend);
 	vprintf(stdout, "%s", type == LEAF ? "leaf" : "dir ");
-	fprintf(stdout, "%10d\t%s\n", ino, name);
+	fprintf(stdout, "%10ju\t%s\n", (uintmax_t)ino, name);
 	return (descend);
 }
 
@@ -83,7 +85,7 @@
 	if (ino == WINO && command == 'i' && !vflag)
 		return (descend);
 	if (!mflag) {
-		(void) sprintf(buf, "./%u", ino);
+		(void) sprintf(buf, "./%ju", (uintmax_t)ino);
 		name = buf;
 		if (type == NODE) {
 			(void) genliteraldir(name, ino);
@@ -457,8 +459,8 @@
 	 * next incremental tape.
 	 */
 	case 0:
-		fprintf(stderr, "%s: (inode %d) not found on tape\n",
-			name, ino);
+		fprintf(stderr, "%s: (inode %ju) not found on tape\n",
+		    name, (uintmax_t)ino);
 		break;
 
 	/*
@@ -612,7 +614,7 @@
 		while (first < curfile.ino) {
 			ep = lookupino(first);
 			if (ep == NULL)
-				panic("%d: bad first\n", first);
+				panic("%ju: bad first\n", (uintmax_t)first);
 			fprintf(stderr, "%s: not found on tape\n", myname(ep));
 			ep->e_flags &= ~(NEW|EXTRACT);
 			first = lowerbnd(first);
@@ -625,8 +627,8 @@
 		 * on the next incremental tape.
 		 */
 		if (first != curfile.ino) {
-			fprintf(stderr, "expected next file %d, got %d\n",
-				first, curfile.ino);
+			fprintf(stderr, "expected next file %ju, got %ju\n",
+			    (uintmax_t)first, (uintmax_t)curfile.ino);
 			skipfile();
 			goto next;
 		}
@@ -852,7 +854,7 @@
 		if (np == ep)
 			break;
 	if (np == NULL)
-		panic("missing inumber %d\n", ino);
+		panic("missing inumber %ju\n", (uintmax_t)ino);
 	if (ep->e_type == LEAF && type != LEAF)
 		badentry(ep, "type should be LEAF");
 	return (descend);

Modified: trunk/sbin/restore/restore.h
===================================================================
--- trunk/sbin/restore/restore.h	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/restore.h	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -32,7 +33,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)restore.h	8.3 (Berkeley) 9/13/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sbin/restore/restore.h 204111 2010-02-20 10:19:19Z uqs $
  */
 
 /*

Modified: trunk/sbin/restore/symtab.c
===================================================================
--- trunk/sbin/restore/symtab.c	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/symtab.c	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -32,7 +33,7 @@
 static char sccsid[] = "@(#)symtab.c	8.3 (Berkeley) 4/28/95";
 #endif
 static const char rcsid[] =
-  "$MidnightBSD$";
+  "$FreeBSD: stable/10/sbin/restore/symtab.c 299148 2016-05-06 01:37:06Z pfg $";
 #endif /* not lint */
 
 /*
@@ -52,6 +53,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -100,7 +102,7 @@
 	struct entry **epp;
 
 	if (inum < WINO || inum >= maxino)
-		panic("addino: out of range %d\n", inum);
+		panic("addino: out of range %ju\n", (uintmax_t)inum);
 	epp = &entry[inum % entrytblsize];
 	np->e_ino = inum;
 	np->e_next = *epp;
@@ -121,7 +123,7 @@
 	struct entry **prev;
 
 	if (inum < WINO || inum >= maxino)
-		panic("deleteino: out of range %d\n", inum);
+		panic("deleteino: out of range %ju\n", (uintmax_t)inum);
 	prev = &entry[inum % entrytblsize];
 	for (next = *prev; next != NULL; next = next->e_next) {
 		if (next->e_ino == inum) {
@@ -131,7 +133,7 @@
 		}
 		prev = &next->e_next;
 	}
-	panic("deleteino: %d not found\n", inum);
+	panic("deleteino: %ju not found\n", (uintmax_t)inum);
 }
 
 /*
@@ -559,6 +561,7 @@
 		fprintf(stderr, "read: %s\n", strerror(errno));
 		panic("cannot read symbol table file %s\n", filename);
 	}
+	(void)close(fd);
 	switch (command) {
 	case 'r':
 		/*

Modified: trunk/sbin/restore/tape.c
===================================================================
--- trunk/sbin/restore/tape.c	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/tape.c	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -39,7 +40,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/restore/tape.c 299954 2016-05-16 16:29:56Z pfg $");
 
 #include <sys/param.h>
 #include <sys/file.h>
@@ -104,7 +105,7 @@
 static void	 findinode(struct s_spcl *);
 static void	 findtapeblksize(void);
 static char	*setupextattr(int);
-static void	 xtrattr(char *, long);
+static void	 xtrattr(char *, size_t);
 static void	 set_extattr_link(char *, void *, int);
 static void	 set_extattr_fd(int, char *, void *, int);
 static int	 gethead(struct s_spcl *);
@@ -114,12 +115,12 @@
 static u_char	*swablong(u_char *, int);
 static u_char	*swabshort(u_char *, int);
 static void	 terminateinput(void);
-static void	 xtrfile(char *, long);
-static void	 xtrlnkfile(char *, long);
-static void	 xtrlnkskip(char *, long);
-static void	 xtrmap(char *, long);
-static void	 xtrmapskip(char *, long);
-static void	 xtrskip(char *, long);
+static void	 xtrfile(char *, size_t);
+static void	 xtrlnkfile(char *, size_t);
+static void	 xtrlnkskip(char *, size_t);
+static void	 xtrmap(char *, size_t);
+static void	 xtrmapskip(char *, size_t);
+static void	 xtrskip(char *, size_t);
 
 /*
  * Set up an input source
@@ -260,9 +261,11 @@
 		fssize = TP_BSIZE;
 	if (stbuf.st_blksize >= TP_BSIZE && stbuf.st_blksize <= MAXBSIZE)
 		fssize = stbuf.st_blksize;
-	if (((fssize - 1) & fssize) != 0) {
-		fprintf(stderr, "bad block size %ld\n", fssize);
-		done(1);
+	if (((TP_BSIZE - 1) & stbuf.st_blksize) != 0) {
+		fprintf(stderr, "Warning: filesystem with non-multiple-of-%d "
+		    "blocksize (%d);\n", TP_BSIZE, stbuf.st_blksize);
+		fssize = roundup(fssize, TP_BSIZE);
+		fprintf(stderr, "\twriting using blocksize %ld\n", fssize);
 	}
 	if (spcl.c_volume != 1) {
 		fprintf(stderr, "Tape is not volume 1 of the dump\n");
@@ -278,7 +281,7 @@
 		done(1);
 	}
 	maxino = (spcl.c_count * TP_BSIZE * NBBY) + 1;
-	dprintf(stdout, "maxino = %d\n", maxino);
+	dprintf(stdout, "maxino = %ju\n", (uintmax_t)maxino);
 	map = calloc((unsigned)1, (unsigned)howmany(maxino, NBBY));
 	if (map == NULL)
 		panic("no memory for active inode map\n");
@@ -562,7 +565,7 @@
 int
 extractfile(char *name)
 {
-	int flags;
+	u_int flags;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
@@ -929,13 +932,13 @@
  * to the skip function.
  */
 void
-getfile(void (*datafill)(char *, long), void (*attrfill)(char *, long),
-	void (*skip)(char *, long))
+getfile(void (*datafill)(char *, size_t), void (*attrfill)(char *, size_t),
+	void (*skip)(char *, size_t))
 {
 	int i;
-	off_t size;
+	volatile off_t size;
 	int curblk, attrsize;
-	void (*fillit)(char *, long);
+	void (*fillit)(char *, size_t);
 	static char clearedbuf[MAXBSIZE];
 	char buf[MAXBSIZE / TP_BSIZE][TP_BSIZE];
 	char junk[TP_BSIZE];
@@ -1054,8 +1057,9 @@
 	}
 	extbufsize = 0;
 	extbuf = NULL;
-	fprintf(stderr, "Cannot extract %d bytes %s for inode %d, name %s\n",
-	    extsize, "of extended attributes", curfile.ino, curfile.name);
+	fprintf(stderr, "Cannot extract %d bytes %s for inode %ju, name %s\n",
+	    extsize, "of extended attributes", (uintmax_t)curfile.ino,
+	    curfile.name);
 	return (NULL);
 }
 
@@ -1063,7 +1067,7 @@
  * Extract the next block of extended attributes.
  */
 static void
-xtrattr(char *buf, long size)
+xtrattr(char *buf, size_t size)
 {
 
 	if (extloc + size > extbufsize)
@@ -1076,7 +1080,7 @@
  * Write out the next block of a file.
  */
 static void
-xtrfile(char *buf, long	size)
+xtrfile(char *buf, size_t size)
 {
 
 	if (Nflag)
@@ -1083,8 +1087,8 @@
 		return;
 	if (write(ofile, buf, (int) size) == -1) {
 		fprintf(stderr,
-		    "write error extracting inode %d, name %s\nwrite: %s\n",
-			curfile.ino, curfile.name, strerror(errno));
+		    "write error extracting inode %ju, name %s\nwrite: %s\n",
+		    (uintmax_t)curfile.ino, curfile.name, strerror(errno));
 	}
 }
 
@@ -1093,13 +1097,13 @@
  */
 /* ARGSUSED */
 static void
-xtrskip(char *buf, long size)
+xtrskip(char *buf, size_t size)
 {
 
 	if (lseek(ofile, size, SEEK_CUR) == -1) {
 		fprintf(stderr,
-		    "seek error extracting inode %d, name %s\nlseek: %s\n",
-			curfile.ino, curfile.name, strerror(errno));
+		    "seek error extracting inode %ju, name %s\nlseek: %s\n",
+		    (uintmax_t)curfile.ino, curfile.name, strerror(errno));
 		done(1);
 	}
 }
@@ -1108,7 +1112,7 @@
  * Collect the next block of a symbolic link.
  */
 static void
-xtrlnkfile(char *buf, long size)
+xtrlnkfile(char *buf, size_t size)
 {
 
 	pathlen += size;
@@ -1125,7 +1129,7 @@
  */
 /* ARGSUSED */
 static void
-xtrlnkskip(char *buf, long size)
+xtrlnkskip(char *buf, size_t size)
 {
 
 	fprintf(stderr, "unallocated block in symbolic link %s\n",
@@ -1137,7 +1141,7 @@
  * Collect the next block of a bit map.
  */
 static void
-xtrmap(char *buf, long size)
+xtrmap(char *buf, size_t size)
 {
 
 	memmove(map, buf, size);
@@ -1149,7 +1153,7 @@
  */
 /* ARGSUSED */
 static void
-xtrmapskip(char *buf, long size)
+xtrmapskip(char *buf, size_t size)
 {
 
 	panic("hole in map\n");
@@ -1161,7 +1165,7 @@
  */
 /* ARGSUSED */
 void
-xtrnull(char *buf, long size)
+xtrnull(char *buf, size_t size)
 {
 
 	return;
@@ -1247,8 +1251,8 @@
 			fprintf(stderr, "restoring %s\n", curfile.name);
 			break;
 		case SKIP:
-			fprintf(stderr, "skipping over inode %d\n",
-				curfile.ino);
+			fprintf(stderr, "skipping over inode %ju\n",
+			    (uintmax_t)curfile.ino);
 			break;
 		}
 		if (!yflag && !reply("continue"))
@@ -1481,10 +1485,11 @@
 		fprintf(stderr, "Used inodes map header");
 		break;
 	case TS_INODE:
-		fprintf(stderr, "File header, ino %d", previno);
+		fprintf(stderr, "File header, ino %ju", (uintmax_t)previno);
 		break;
 	case TS_ADDR:
-		fprintf(stderr, "File continuation header, ino %d", previno);
+		fprintf(stderr, "File continuation header, ino %ju",
+		    (uintmax_t)previno);
 		break;
 	case TS_END:
 		fprintf(stderr, "End of tape header");
@@ -1635,8 +1640,8 @@
 	}
 
 	if (i != CHECKSUM) {
-		fprintf(stderr, "Checksum error %o, inode %d file %s\n", i,
-			curfile.ino, curfile.name);
+		fprintf(stderr, "Checksum error %o, inode %ju file %s\n", i,
+		    (uintmax_t)curfile.ino, curfile.name);
 		return(FAIL);
 	}
 	return(GOOD);

Modified: trunk/sbin/restore/utilities.c
===================================================================
--- trunk/sbin/restore/utilities.c	2018-06-19 18:06:07 UTC (rev 11091)
+++ trunk/sbin/restore/utilities.c	2018-06-19 18:06:49 UTC (rev 11092)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -32,7 +33,7 @@
 static char sccsid[] = "@(#)utilities.c	8.5 (Berkeley) 4/28/95";
 #endif
 static const char rcsid[] =
-  "$MidnightBSD$";
+  "$FreeBSD: stable/10/sbin/restore/utilities.c 236213 2012-05-29 01:48:06Z kevlo $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -411,6 +412,7 @@
 	va_list ap;
 	va_start(ap, fmt);
 	vfprintf(stderr, fmt, ap);
+	va_end(ap);
 	if (yflag)
 		return;
 	if (reply("abort") == GOOD) {



More information about the Midnightbsd-cvs mailing list