Correct failure to build on i386

Signed-off-by: Tony Asleson <tasleson@redhat.com>
This commit is contained in:
Tony Asleson 2022-04-07 13:18:32 -05:00
parent a6af18e888
commit a257d4d6b1
2 changed files with 26 additions and 1 deletions

21
0002-use-snprintf.patch Normal file
View File

@ -0,0 +1,21 @@
diff --git a/c_binding/lsm_local_disk.c b/c_binding/lsm_local_disk.c
index 4e8277b..9e3e02e 100644
--- a/c_binding/lsm_local_disk.c
+++ b/c_binding/lsm_local_disk.c
@@ -1093,13 +1093,12 @@ static void _sysfs_sas_addr_get(const char *blk_name, char *tp_sas_addr) {
memset(sysfs_sas_addr, 0, _SYSFS_SAS_ADDR_LEN);
memset(tp_sas_addr, 0, _SG_T10_SPL_SAS_ADDR_LEN);
- sysfs_sas_path = (char *)malloc(sizeof(char) *
- (strlen("/sys/block//device/sas_address") +
- strlen(blk_name) + 1 /* trailing \0 */));
+ sysfs_sas_path = (char *)malloc(PATH_MAX);
if (sysfs_sas_path == NULL)
goto out;
- sprintf(sysfs_sas_path, "/sys/block/%s/device/sas_address", blk_name);
+ snprintf(sysfs_sas_path, PATH_MAX,
+ "/sys/block/%s/device/sas_address", blk_name);
if (!_file_exists(sysfs_sas_path))
goto out;

View File

@ -2,12 +2,13 @@
Name: libstoragemgmt
Version: 1.9.4
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Storage array management library
License: LGPLv2+
URL: https://github.com/libstorage/libstoragemgmt
Source0: https://github.com/libstorage/libstoragemgmt/releases/download/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-change-run-dir.patch
Patch2: 0002-use-snprintf.patch
Requires: python3-%{name}%{_isa}
# Packages that have been removed
@ -446,6 +447,9 @@ fi
%{_mandir}/man1/local_lsmplugin.1*
%changelog
* Thu Apr 7 2022 Tony Asleson <tasleson@redhat.com> - 1.9.4-2
- Fix failure to build on i386
* Thu Apr 7 2022 Tony Asleson <tasleson@redhat.com> - 1.9.4-1
- Upgrade to 1.9.4