Date: Thu, 3 Apr 2008 23:00:37 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 139306 for review Message-ID: <200804032300.m33N0bts045315@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=139306 Change 139306 by sam@sam_ebb on 2008/04/03 23:00:21 IFC @ 139304 Affected files ... .. //depot/projects/vap/lib/libc/gen/err.c#3 integrate .. //depot/projects/vap/sbin/restore/dirs.c#3 integrate .. //depot/projects/vap/sbin/restore/interactive.c#3 integrate Differences ... ==== //depot/projects/vap/lib/libc/gen/err.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.14 2007/01/09 00:27:53 imp Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.15 2008/04/03 20:36:44 imp Exp $"); #include "namespace.h" #include <err.h> @@ -97,11 +97,7 @@ } void -verrc(eval, code, fmt, ap) - int eval; - int code; - const char *fmt; - va_list ap; +verrc(int eval, int code, const char *fmt, va_list ap) { if (err_file == 0) err_set_file((FILE *)0); @@ -126,10 +122,7 @@ } void -verrx(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; +verrx(int eval, const char *fmt, va_list ap) { if (err_file == 0) err_set_file((FILE *)0); @@ -154,9 +147,7 @@ } void -vwarn(fmt, ap) - const char *fmt; - va_list ap; +vwarn(const char *fmt, va_list ap) { vwarnc(errno, fmt, ap); } @@ -171,10 +162,7 @@ } void -vwarnc(code, fmt, ap) - int code; - const char *fmt; - va_list ap; +vwarnc(int code, const char *fmt, va_list ap) { if (err_file == 0) err_set_file((FILE *)0); @@ -196,9 +184,7 @@ } void -vwarnx(fmt, ap) - const char *fmt; - va_list ap; +vwarnx(const char *fmt, va_list ap) { if (err_file == 0) err_set_file((FILE *)0); ==== //depot/projects/vap/sbin/restore/dirs.c#3 (text+ko) ==== @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)dirs.c 8.7 (Berkeley) 5/1/95"; #endif static const char rcsid[] = - "$FreeBSD: src/sbin/restore/dirs.c,v 1.31 2007/02/26 08:15:56 mckusick Exp $"; + "$FreeBSD: src/sbin/restore/dirs.c,v 1.32 2008/04/03 20:37:38 imp Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -216,7 +216,7 @@ struct direct *dp; int namelen; long bpt; - char locname[MAXPATHLEN + 1]; + char locname[MAXPATHLEN]; itp = inotablookup(ino); if (itp == NULL) { @@ -235,9 +235,8 @@ * begin search through the directory * skipping over "." and ".." */ - (void) strncpy(locname, pname, sizeof(locname) - 1); - locname[sizeof(locname) - 1] = '\0'; - (void) strncat(locname, "/", sizeof(locname) - strlen(locname)); + (void) strlcpy(locname, pname, sizeof(locname)); + (void) strlcat(locname, "/", sizeof(locname)); namelen = strlen(locname); rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); dp = rst_readdir(dirp); /* "." */ @@ -261,7 +260,7 @@ fprintf(stderr, "%s%s: name exceeds %d char\n", locname, dp->d_name, sizeof(locname) - 1); } else { - (void) strncat(locname, dp->d_name, (int)dp->d_namlen); + (void)strlcat(locname, dp->d_name, sizeof(locname)); treescan(locname, dp->d_ino, todo); rst_seekdir(dirp, bpt, itp->t_seekpt); } ==== //depot/projects/vap/sbin/restore/interactive.c#3 (text+ko) ==== @@ -34,7 +34,7 @@ #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sbin/restore/interactive.c,v 1.18 2005/07/21 16:12:35 dds Exp $"); +__FBSDID("$FreeBSD: src/sbin/restore/interactive.c,v 1.19 2008/04/03 20:37:38 imp Exp $"); #include <sys/param.h> #include <sys/stat.h> @@ -502,7 +502,7 @@ struct afile single; RST_DIR *dirp; int entries, len, namelen; - char locname[MAXPATHLEN + 1]; + char locname[MAXPATHLEN]; dp = pathsearch(name); if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) || @@ -533,8 +533,8 @@ fprintf(stderr, "%s:\n", name); entries = 0; listp = list; - (void) strncpy(locname, name, MAXPATHLEN); - (void) strncat(locname, "/", MAXPATHLEN); + (void)strlcpy(locname, name, MAXPATHLEN); + (void)strlcat(locname, "/", MAXPATHLEN); namelen = strlen(locname); while ((dp = rst_readdir(dirp))) { if (dp == NULL) @@ -545,13 +545,11 @@ strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)) continue; - locname[namelen] = '\0'; if (namelen + dp->d_namlen >= MAXPATHLEN) { fprintf(stderr, "%s%s: name exceeds %d char\n", locname, dp->d_name, MAXPATHLEN); } else { - (void) strncat(locname, dp->d_name, - (int)dp->d_namlen); + (void)strlcat(locname, dp->d_name, MAXPATHLEN); mkentry(locname, dp, listp++); entries++; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804032300.m33N0bts045315>