Make test check the tv_nsec part of a struct stat when comparing

the mtimes of a file. (This is probably only useful if you have
vfs.timestamp_precision set to something nonzero).

PR:		39163
Submitted by:	Hal Burch <hburch@lumeta.com>
MFC after:	2 weeks
This commit is contained in:
David Malone 2002-07-27 22:53:44 +00:00
parent 9bd85872d1
commit 6576952ca5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100774

View File

@ -521,19 +521,21 @@ newerf (const char *f1, const char *f2)
{
struct stat b1, b2;
return (stat (f1, &b1) == 0 &&
stat (f2, &b2) == 0 &&
b1.st_mtime > b2.st_mtime);
if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0)
return 0;
if (b1.st_mtimespec.tv_sec > b2.st_mtimespec.tv_sec)
return 1;
if (b1.st_mtimespec.tv_sec < b2.st_mtimespec.tv_sec)
return 0;
return (b1.st_mtimespec.tv_nsec > b2.st_mtimespec.tv_nsec);
}
static int
olderf (const char *f1, const char *f2)
{
struct stat b1, b2;
return (stat (f1, &b1) == 0 &&
stat (f2, &b2) == 0 &&
b1.st_mtime < b2.st_mtime);
return (newerf(f2, f1));
}
static int