mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
Detect file modification properly by using tv_nsec.
POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond precision to detect file modification. MFC after: 2 weeks
This commit is contained in:
parent
8fac9b7b7d
commit
e6ad3d22f4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231383
|
@ -347,7 +347,8 @@ pw_edit(int notsetuid)
|
|||
sigprocmask(SIG_SETMASK, &oldsigset, NULL);
|
||||
if (stat(tempname, &st2) == -1)
|
||||
return (-1);
|
||||
return (st1.st_mtime != st2.st_mtime);
|
||||
return (st1.st_mtim.tv_sec != st2.st_mtim.tv_sec ||
|
||||
st1.st_mtim.tv_nsec != st2.st_mtim.tv_nsec);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
.\" @(#)vipw.8 8.1 (Berkeley) 6/6/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd June 6, 1993
|
||||
.Dd February 10, 2011
|
||||
.Dt VIPW 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -110,10 +110,3 @@ The
|
|||
.Nm
|
||||
utility appeared in
|
||||
.Bx 4.0 .
|
||||
.Sh BUGS
|
||||
The mechanism for checking for password file modifications requires that
|
||||
.Ev EDITOR
|
||||
run for at least one second.
|
||||
Non-interactive editor scripts should invoke
|
||||
.Xr sleep 1
|
||||
or equivalent to ensure this happens.
|
||||
|
|
Loading…
Reference in a new issue