]> sourceware.org Git - lvm2.git/commitdiff
cov: some stack tracing corrections
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 5 Jan 2024 14:13:42 +0000 (15:13 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 10 Jan 2024 13:02:22 +0000 (14:02 +0100)
Checking some returned values and adding/correcting
some debug tracing.

lib/device/dev-cache.c
lib/device/dev-mpath.c
lib/device/device_id.c

index e038263acfe296c51c992924c5bb86d1bcfbd61a..d61185ff48308506a7c7158c4e5d4bca35bd8109 100644 (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;
        }
 
index 8e4393a2176425e0aca0aa92e579156f9b82cf97..3417f392ff487586965f63d2b8571064d48b0323 100644 (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;
 }
-
-
index 425c0d64bdf7515ef0ce7b2a53c568e01ff3f8c5..8fa7b519d72bf57954ffbc1e6d07c3584f59f989 100644 (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,
This page took 0.039197 seconds and 5 git commands to generate.