From 5e44220cea810f5870dc11996bd1c60976d236ef Mon Sep 17 00:00:00 2001 From: bde Date: Sat, 1 Nov 2003 08:43:54 +0000 Subject: Fixed breakage of my world in rev.1.30. #include instead of depending on namespace pollution in for the declarations of struct timeval and utimes(). Fixed some style bugs in rev.1.30 and some nearby style bugs (mainly unsorting and missing or extra blank lines). Removed a wrong comment that was obtained from NetBSD in rev.1.14. It said that chflags() reset the times that were set "above" by utimes(), but utimes wasn't "above" in FreeBSD until rev.1.30, and chflags() does't actually reset the times. --- usr.sbin/mtree/compare.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'usr.sbin/mtree') diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c index fbe9775..108d16e 100644 --- a/usr.sbin/mtree/compare.c +++ b/usr.sbin/mtree/compare.c @@ -37,7 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include + #include #include #include @@ -45,16 +46,18 @@ __FBSDID("$FreeBSD$"); #ifdef MD5 #include #endif -#ifdef SHA1 -#include -#endif #ifdef RMD160 #include #endif +#ifdef SHA1 +#include +#endif #include #include #include #include +#include + #include "mtree.h" #include "extern.h" @@ -73,6 +76,7 @@ static const char *ftype(u_int); int compare(char *name __unused, NODE *s, FTSENT *p) { + struct timeval tv[2]; uint32_t val; int fd, label; off_t len; @@ -187,7 +191,6 @@ typeerr: LABEL; (void)printf("found %.24s", ctime(&p->fts_statp->st_mtimespec.tv_sec)); if (uflag) { - struct timeval tv[2]; tv[0].tv_sec = s->st_mtimespec.tv_sec; tv[0].tv_usec = s->st_mtimespec.tv_nsec / 1000; tv[1] = tv[0]; @@ -198,7 +201,6 @@ typeerr: LABEL; (void)printf(" modified\n"); } else (void)printf("\n"); - tab = "\t"; } if (s->flags & F_CKSUM) { @@ -223,12 +225,6 @@ typeerr: LABEL; } } } - /* - * XXX - * since chflags(2) will reset file times, the utimes() above - * may have been useless! oh well, we'd rather have correct - * flags, rather than times? - */ if ((s->flags & F_FLAGS) && s->st_flags != p->fts_statp->st_flags) { LABEL; fflags = flags_to_string(s->st_flags); @@ -364,9 +360,9 @@ ftype(u_int type) char * rlink(char *name) { - char tbuf[MAXPATHLEN]; static char lbuf[MAXPATHLEN * 4]; int len; + char tbuf[MAXPATHLEN]; if ((len = readlink(name, tbuf, sizeof(tbuf) - 1)) == -1) err(1, "line %d: %s", lineno, name); -- cgit v1.1