1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-29 00:27:11 +00:00

Use timespeccmp() and st_mtim intead of comparing st_mtime.

Fixes comparison of files with modification times that differ
by less than a second.  From Collin Funk.
This commit is contained in:
millert
2025-03-24 20:15:08 +00:00
parent d61098b9b5
commit 0ecf0981e5

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: test.c,v 1.22 2024/08/15 06:27:24 guenther Exp $ */
/* $OpenBSD: test.c,v 1.23 2025/03/24 20:15:08 millert Exp $ */
/* $NetBSD: test.c,v 1.15 1995/03/21 07:04:06 cgd Exp $ */
/*
@@ -546,7 +546,7 @@ newerf(const char *f1, const char *f2)
return (stat(f1, &b1) == 0 &&
stat(f2, &b2) == 0 &&
b1.st_mtime > b2.st_mtime);
timespeccmp(&b1.st_mtim, &b2.st_mtim, >));
}
static int
@@ -556,7 +556,7 @@ olderf(const char *f1, const char *f2)
return (stat(f1, &b1) == 0 &&
stat(f2, &b2) == 0 &&
b1.st_mtime < b2.st_mtime);
timespeccmp(&b1.st_mtim, &b2.st_mtim, <));
}
static int