diff --git a/cmdline/parity.c b/cmdline/parity.c index 7a1ab29b..5d84ed0c 100644 --- a/cmdline/parity.c +++ b/cmdline/parity.c @@ -201,7 +201,6 @@ int parity_create(struct snapraid_parity_handle* handle, const struct snapraid_p split->f = -1; split->size = parity->split_map[s].size; split->limit_size = PARITY_LIMIT(limit_size, s, level); - ++handle->split_mac; /* opening in sequential mode in Windows */ flags = O_RDWR | O_CREAT | O_BINARY | advise_flags(&split->advise); @@ -213,6 +212,9 @@ int parity_create(struct snapraid_parity_handle* handle, const struct snapraid_p /* LCOV_EXCL_STOP */ } + /* we have a valid file handle */ + ++handle->split_mac; + /* get the stat info */ ret = fstat(split->f, &split->st); if (ret != 0) { @@ -558,7 +560,6 @@ int parity_open(struct snapraid_parity_handle* handle, const struct snapraid_par split->f = -1; split->size = parity->split_map[s].size; split->limit_size = PARITY_LIMIT(limit_size, s, level); - ++handle->split_mac; /* open for read */ /* O_NOATIME: do not change access time */ @@ -570,6 +571,9 @@ int parity_open(struct snapraid_parity_handle* handle, const struct snapraid_par goto bail; } + /* we have a valid file handle */ + ++handle->split_mac; + /* get the stat info */ ret = fstat(split->f, &split->st); if (ret != 0) {