1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: some stack tracing corrections

Checking some returned values and adding/correcting
some debug tracing.
This commit is contained in:
Zdenek Kabelac 2024-01-05 15:13:42 +01:00
parent a882878eba
commit 18d3283157
3 changed files with 9 additions and 7 deletions

View File

@ -409,13 +409,13 @@ int get_sysfs_value(const char *path, char *buf, size_t buf_size, int error_if_n
if (!(fp = fopen(path, "r"))) {
if (error_if_no_value)
log_sys_error("fopen", path);
log_sys_debug("fopen", path);
return 0;
}
if (!fgets(buf, buf_size, fp)) {
if (error_if_no_value)
log_sys_error("fgets", path);
log_sys_debug("fgets", path);
goto out;
}

View File

@ -759,12 +759,14 @@ const char *dev_mpath_component_wwid(struct cmd_context *cmd, struct device *dev
/* read /sys/block/sda/device/wwid */
if (dm_snprintf(wwid_path, sizeof(wwid_path), "%sblock/%s/device/wwid",
dm_sysfs_dir(), slave_name) < 0) {
dm_sysfs_dir(), slave_name) < 0) {
log_warn("Failed to create sysfs wwid path for %s", slave_name);
continue;
}
get_sysfs_value(wwid_path, sysbuf, sizeof(sysbuf), 0);
if (!get_sysfs_value(wwid_path, sysbuf, sizeof(sysbuf), 0))
stack;
if (!sysbuf[0])
continue;
@ -784,5 +786,3 @@ const char *dev_mpath_component_wwid(struct cmd_context *cmd, struct device *dev
return wwid;
}

View File

@ -215,7 +215,9 @@ static int _searched_devnames_exists(struct cmd_context *cmd,
if (pvids_ok && devs_ok)
ret = 1;
out:
fclose(fp);
if (fclose(fp))
log_sys_debug("fclose", _searched_file);
log_debug("searched_devnames %s file pvids %d %u devs %d %u search pvids %d %u devs %d %u",
ret ? "match" : "differ",
pvids_count_file, pvids_hash_file, devs_count_file, devs_hash_file,