mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Reject non-regular data and parity files after opening
This commit is contained in:
parent
8f0bc80774
commit
c2be8536bf
2 changed files with 34 additions and 0 deletions
|
|
@ -137,6 +137,15 @@ int handle_open_create(struct snapraid_handle* handle, struct snapraid_file* fil
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (!S_ISREG(handle->st.st_mode)) {
|
||||
/* LCOV_EXCL_START */
|
||||
errno = ESOFT;
|
||||
log_fatal(errno, "Error accessing file '%s' for not regular file.\n", handle->path);
|
||||
handle_close(handle);
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ret = advise_open(&handle->advise, handle->f);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
|
|
@ -323,6 +332,15 @@ int handle_open(struct snapraid_handle* handle, struct snapraid_file* file, int
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (!S_ISREG(handle->st.st_mode)) {
|
||||
/* LCOV_EXCL_START */
|
||||
errno = ESOFT;
|
||||
log_error(errno, "Error accessing file '%s' for not regular file.\n", handle->path);
|
||||
handle_close(handle);
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ret = advise_open(&handle->advise, handle->f);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
|
|
|
|||
|
|
@ -212,6 +212,14 @@ int parity_create(struct snapraid_parity_handle* handle, const struct snapraid_p
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (!S_ISREG(split->st.st_mode)) {
|
||||
/* LCOV_EXCL_START */
|
||||
errno = ESOFT;
|
||||
log_fatal(errno, "Error accessing parity file '%s' for not regular file.\n", split->path);
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/**
|
||||
* If the parity size is not yet set, set it now.
|
||||
* This happens when adding a new parity level or split that has
|
||||
|
|
@ -868,6 +876,14 @@ int parity_open(struct snapraid_parity_handle* handle, const struct snapraid_par
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (!S_ISREG(split->st.st_mode)) {
|
||||
/* LCOV_EXCL_START */
|
||||
errno = ESOFT;
|
||||
log_fatal(errno, "Error accessing parity file '%s' for not regular file.\n", split->path);
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/**
|
||||
* If the parity size is not yet set, set it now.
|
||||
* This happens when adding a new parity level or split that has
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue