mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-04 13:50:09 -05:00
Add S_ISBLK checks to devdereference_btrfs and devdereference_bcachefs
This commit is contained in:
parent
f908b122a5
commit
40ad88efac
1 changed files with 19 additions and 1 deletions
|
|
@ -682,7 +682,7 @@ static int devdereference_btrfs(uint64_t device, const char* dir, int fd, tommy_
|
||||||
/* btrfs device IDs (devid) are not guaranteed to be contiguous */
|
/* btrfs device IDs (devid) are not guaranteed to be contiguous */
|
||||||
if (errno == ENODEV || errno == ENOENT)
|
if (errno == ENODEV || errno == ENOENT)
|
||||||
continue; /* this is the expected error on missing id */
|
continue; /* this is the expected error on missing id */
|
||||||
log_error(errno, "Ioctl BTRFS_IOC_DEV_INFO failed. %s.", strerror(errno));
|
log_error(errno, "Failed ioctl BTRFS_IOC_DEV_INFO. %s.", strerror(errno));
|
||||||
goto bail;
|
goto bail;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -691,6 +691,14 @@ static int devdereference_btrfs(uint64_t device, const char* dir, int fd, tommy_
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat((char*)dev_info.path, &st) != 0) {
|
if (stat((char*)dev_info.path, &st) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_error(errno, "Failed stat %s. %s.", dev_info.path, strerror(errno));
|
||||||
|
goto bail;
|
||||||
|
/* LCOV_EXCL_STOP */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!S_ISBLK(st.st_mode)) {
|
||||||
|
/* LCOV_EXCL_START */
|
||||||
|
log_error(errno, "Device %s is not a block device.", dev_info.path);
|
||||||
goto bail;
|
goto bail;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -811,6 +819,14 @@ static int devdereference_bcachefs(uint64_t device, const char* dir, tommy_list*
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(dev_map[i], &st) != 0) {
|
if (stat(dev_map[i], &st) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_error(errno, "Failed stat %s. %s.", dev_map[i], strerror(errno));
|
||||||
|
goto bail;
|
||||||
|
/* LCOV_EXCL_STOP */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!S_ISBLK(st.st_mode)) {
|
||||||
|
/* LCOV_EXCL_START */
|
||||||
|
log_error(errno, "Device %s is not a block device.", dev_map[i]);
|
||||||
goto bail;
|
goto bail;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
@ -972,6 +988,7 @@ static int devdereference_zfs(uint64_t device, const char* dir, tommy_list* devl
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(file, &st) != 0) {
|
if (stat(file, &st) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_error(errno, "Failed stat %s. %s.", file, strerror(errno));
|
||||||
os_pclose(fp);
|
os_pclose(fp);
|
||||||
goto bail;
|
goto bail;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
@ -979,6 +996,7 @@ static int devdereference_zfs(uint64_t device, const char* dir, tommy_list* devl
|
||||||
|
|
||||||
if (!S_ISBLK(st.st_mode)) {
|
if (!S_ISBLK(st.st_mode)) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
log_error(errno, "Device %s is not a block device.", file);
|
||||||
os_pclose(fp);
|
os_pclose(fp);
|
||||||
goto bail;
|
goto bail;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue