mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libdasd: Check return value for util_file_read_l
The return code of util_file_read_l() isn't checked and therefore 'value' could contain anything in case of an error. Check the return code and set 'value' to 0 in the error case. Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/110 Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -218,7 +218,8 @@ int dasd_get_host_access_count(char *device)
|
||||
return 0;
|
||||
|
||||
path = util_path_sysfs("bus/ccw/devices/%s/host_access_count", busid);
|
||||
util_file_read_l(&value, 10, path);
|
||||
if (util_file_read_l(&value, 10, path))
|
||||
value = 0;
|
||||
free(path);
|
||||
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user