diff options
author | Ed Schouten <ed@FreeBSD.org> | 2012-02-10 13:40:32 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2012-02-10 13:40:32 +0000 |
commit | e6ad3d22f47f371ff7c01aac74d3d9eed6ca0f7d (patch) | |
tree | 88bb269cd0f763176f4844bd4983c92e6f0bc0b2 /lib/libutil/pw_util.c | |
parent | 8fac9b7b7d26264167cf3abf474695f27cde3382 (diff) |
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
Notes
Notes:
svn path=/head/; revision=231383
Diffstat (limited to 'lib/libutil/pw_util.c')
-rw-r--r-- | lib/libutil/pw_util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index 5cd27b155ff4..63c63de81aa6 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/pw_util.c @@ -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); } /* |