mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Encodes STAT_NSEC_INVALID as 0 adding 1 to other values.
This commit is contained in:
parent
adaf87a17d
commit
6878f3f28c
1 changed files with 11 additions and 1 deletions
12
state.c
12
state.c
|
|
@ -2078,6 +2078,12 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* STAT_NSEC_INVALID is encoded as 0 */
|
||||
if (v_mtime_nsec == 0)
|
||||
v_mtime_nsec = STAT_NSEC_INVALID;
|
||||
else
|
||||
--v_mtime_nsec;
|
||||
|
||||
/* ignore nanoseconds if asked to find by name */
|
||||
if (state->opt.force_by_name)
|
||||
v_mtime_nsec = STAT_NSEC_INVALID;
|
||||
|
|
@ -2802,7 +2808,11 @@ static void state_write_binary(struct snapraid_state* state, STREAM* f)
|
|||
sputbs(disk->name, f);
|
||||
sputb64(size, f);
|
||||
sputb64(mtime_sec, f);
|
||||
sputb32(mtime_nsec, f);
|
||||
/* encode STAT_NSEC_INVALID as 0 */
|
||||
if (mtime_nsec == STAT_NSEC_INVALID)
|
||||
sputb32(0, f);
|
||||
else
|
||||
sputb32(mtime_nsec + 1, f);
|
||||
sputb64(inode, f);
|
||||
sputbs(file->sub, f);
|
||||
if (serror(f)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue