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.
This commit is contained in:
bde 2003-11-01 08:43:54 +00:00
parent cdb4de5776
commit 5e44220cea

View File

@ -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);