mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Reject incomplete ZFS device lists when zpool status fails
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
This commit is contained in:
parent
6f74455864
commit
2a2b876fef
1 changed files with 24 additions and 2 deletions
|
|
@ -1103,7 +1103,12 @@ static int extract_zfs(const char* dir, char* dataset, size_t dataset_size, char
|
|||
}
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_error(ESOFT, "Failed to list ZFS dataset '%s' (status %d).\n", mounted_dataset, ret);
|
||||
if (WIFEXITED(ret))
|
||||
log_error(ESOFT, "Failed to list ZFS dataset '%s' (exit status %d).\n", mounted_dataset, WEXITSTATUS(ret));
|
||||
else if (WIFSIGNALED(ret))
|
||||
log_error(ESOFT, "Failed to list ZFS dataset '%s' (signal %d).\n", mounted_dataset, WTERMSIG(ret));
|
||||
else
|
||||
log_error(ESOFT, "Failed to list ZFS dataset '%s' (unexpected wait status %d).\n", mounted_dataset, ret);
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -1236,7 +1241,24 @@ static int devdereference_zfs(uint64_t device, const char* dir, tommy_list* devl
|
|||
log_tag("dereference:zfs:%s:%u:%u:%u:%u\n", dir, major(device), minor(device), major(dev->device), minor(dev->device));
|
||||
}
|
||||
|
||||
os_pclose(fp);
|
||||
int ret = os_pclose(fp);
|
||||
if (ret < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_error(errno, "Failed to close ZFS pool status for '%s'. %s.\n", pool, strerror(errno));
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
if (WIFEXITED(ret))
|
||||
log_error(ESOFT, "Failed to get ZFS pool status for '%s' (exit status %d).\n", pool, WEXITSTATUS(ret));
|
||||
else if (WIFSIGNALED(ret))
|
||||
log_error(ESOFT, "Failed to get ZFS pool status for '%s' (signal %d).\n", pool, WTERMSIG(ret));
|
||||
else
|
||||
log_error(ESOFT, "Failed to get ZFS pool status for '%s' (unexpected wait status %d).\n", pool, ret);
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (tommy_list_empty(devlist))
|
||||
goto bail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue