File s390-tools-sles15sp2-libdasd-Fix-dasd_get_host_access_count.patch of Package s390-tools.19134

Subject: [PATCH] [BZ 189021] libdasd: Fix dasd_get_host_access_count()
From: Jan Hoeppner <hoeppner@linux.ibm.com>

Description:   libdasd: Fix dasd_get_host_access_count()
Symptom:       fdasd and dasdfmt don't report host access count anymore.
Problem:       The library function dasd_get_host_access_count() checks for
               unsuccessful execution of util_sys_get_dev_addr() incorrectly.
Solution:      Turn the check around.
Reproduction:  Attach the same DASD on two different LPARs and run dasdfmt on
               one of the LPARs on that DASD.
Upstream-ID:   353403824b5112c254f6788bad5edbbb19b96683
Problem-ID:    189021

Upstream-Description:

              libdasd: Fix dasd_get_host_access_count()

              Since commit 75e3afb6a0c7 ("libdasd: Move get_host_access_count() to
              libdasd") dasd_get_host_access_count() reports always 0 as the check for
              unsuccessful execution of util_sys_get_dev_addr() is incorrect.
              Fix the behaviour by turning the check around.

              Fixes: 75e3afb6a0c7 ("libdasd: Move get_host_access_count() to libdasd")
              Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
              Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>


Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
---
 libdasd/dasd_sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/libdasd/dasd_sys.c
+++ b/libdasd/dasd_sys.c
@@ -214,7 +214,7 @@ int dasd_get_host_access_count(char *dev
 	char *path;
 	long value;
 
-	if (!util_sys_get_dev_addr(device, busid))
+	if (util_sys_get_dev_addr(device, busid) != 0)
 		return 0;
 
 	path = util_path_sysfs("bus/ccw/devices/%s/host_access_count", busid);
openSUSE Build Service is sponsored by