summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mtree
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2003-11-01 08:43:54 +0000
committerbde <bde@FreeBSD.org>2003-11-01 08:43:54 +0000
commit5e44220cea810f5870dc11996bd1c60976d236ef (patch)
treebb5a4f1f555aa62bbdc59d0a2b3e34ad27575931 /usr.sbin/mtree
parentcdb4de5776598d4268ed747fae0db07d647461a4 (diff)
downloadFreeBSD-src-5e44220cea810f5870dc11996bd1c60976d236ef.zip
FreeBSD-src-5e44220cea810f5870dc11996bd1c60976d236ef.tar.gz
Fixed breakage of my world in rev.1.30. #include <sys/time.h> instead of
depending on namespace pollution in <sys/stat.h> 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.
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r--usr.sbin/mtree/compare.c22
1 files changed, 9 insertions, 13 deletions
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 <sys/param.h>
#include <sys/stat.h>
-#include <vis.h>
+#include <sys/time.h>
+
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -45,16 +46,18 @@ __FBSDID("$FreeBSD$");
#ifdef MD5
#include <md5.h>
#endif
-#ifdef SHA1
-#include <sha.h>
-#endif
#ifdef RMD160
#include <ripemd.h>
#endif
+#ifdef SHA1
+#include <sha.h>
+#endif
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
+#include <vis.h>
+
#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);
OpenPOWER on IntegriCloud