mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Avoid touch hiding files modified since the last sync
This commit is contained in:
parent
087781cee9
commit
d210e95997
1 changed files with 13 additions and 0 deletions
|
|
@ -111,6 +111,19 @@ int state_touch(struct snapraid_state* state)
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Touch only files that are still unchanged compared to
|
||||||
|
* the content file. Otherwise changing the timestamp here
|
||||||
|
* could hide a modification from the following scan.
|
||||||
|
*/
|
||||||
|
if (st.st_size != file->size
|
||||||
|
|| st.st_mtime != file->mtime_sec
|
||||||
|
|| STAT_NSEC(&st) != file->mtime_nsec
|
||||||
|
) {
|
||||||
|
close(f);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* set the tweaked modification time, with new nano seconds */
|
/* set the tweaked modification time, with new nano seconds */
|
||||||
ret = fmtime(f, st.st_mtime, nsec);
|
ret = fmtime(f, st.st_mtime, nsec);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue