mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
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:
parent
9bd85872d1
commit
6576952ca5
1 changed files with 10 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue