mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 12:57:14 -05:00
Normalize legacy out-of-range content nanoseconds to STAT_NSEC_INVALID
This commit is contained in:
parent
edb3cacb77
commit
5b402fc462
1 changed files with 16 additions and 6 deletions
|
|
@ -2548,15 +2548,20 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sgetb32(f, &v_mtime_nsec);
|
ret = sgetb32(f, &v_mtime_nsec);
|
||||||
if (ret < 0 || v_mtime_nsec > 1000000000) {
|
if (ret < 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
decoding_error(path, f);
|
decoding_error(path, f);
|
||||||
os_abort();
|
os_abort();
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STAT_NSEC_INVALID is encoded as 0 */
|
/*
|
||||||
if (v_mtime_nsec == 0)
|
* STAT_NSEC_INVALID is encoded as 0.
|
||||||
|
* Values > 1000000000 can occur in content files written by SnapRAID <= 14.10
|
||||||
|
* on Windows for files with pre-1970 timestamps due to negative nanoseconds.
|
||||||
|
* Normalize them to STAT_NSEC_INVALID.
|
||||||
|
*/
|
||||||
|
if (v_mtime_nsec == 0 || v_mtime_nsec > 1000000000)
|
||||||
v_mtime_nsec = STAT_NSEC_INVALID;
|
v_mtime_nsec = STAT_NSEC_INVALID;
|
||||||
else
|
else
|
||||||
--v_mtime_nsec;
|
--v_mtime_nsec;
|
||||||
|
|
@ -3008,15 +3013,20 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sgetb32(f, &v_mtime_nsec);
|
ret = sgetb32(f, &v_mtime_nsec);
|
||||||
if (ret < 0 || v_mtime_nsec > 1000000000) {
|
if (ret < 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
decoding_error(path, f);
|
decoding_error(path, f);
|
||||||
os_abort();
|
os_abort();
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STAT_NSEC_INVALID is encoded as 0 */
|
/*
|
||||||
if (v_mtime_nsec == 0)
|
* STAT_NSEC_INVALID is encoded as 0.
|
||||||
|
* Values > 1000000000 can occur in content files written by SnapRAID <= 14.10
|
||||||
|
* on Windows for files with pre-1970 timestamps due to negative nanoseconds.
|
||||||
|
* Normalize them to STAT_NSEC_INVALID.
|
||||||
|
*/
|
||||||
|
if (v_mtime_nsec == 0 || v_mtime_nsec > 1000000000)
|
||||||
v_mtime_nsec = STAT_NSEC_INVALID;
|
v_mtime_nsec = STAT_NSEC_INVALID;
|
||||||
else
|
else
|
||||||
--v_mtime_nsec;
|
--v_mtime_nsec;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue