Fix build error for check

This commit is contained in:
wangxiaomeng 2024-03-13 16:59:30 +08:00
parent cf2963b696
commit 0f38cceaee
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 541fd2a18c8fbadfaeaedc97815bfab9e0cceda1 Mon Sep 17 00:00:00 2001
From: wangxiaomeng <wangxiaomeng@kylinos.cn>
Date: Wed, 13 Mar 2024 16:49:19 +0800
Subject: [PATCH] Fix build error for check
---
restripe.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/restripe.c b/restripe.c
index 31b07e8..86e1d00 100644
--- a/restripe.c
+++ b/restripe.c
@@ -866,8 +866,16 @@ int test_stripes(int *source, unsigned long long *offsets,
int disk;
for (i = 0 ; i < raid_disks ; i++) {
- lseek64(source[i], offsets[i]+start, 0);
- read(source[i], stripes[i], chunk_size);
+ if ((lseek64(source[i], offsets[i]+start, 0) < 0) ||
+ (read(source[i], stripes[i], chunk_size) !=
+ chunk_size)) {
+ free(q);
+ free(p);
+ free(blocks);
+ free(stripes);
+ free(stripe_buf);
+ return -1;
+ }
}
for (i = 0 ; i < data_disks ; i++) {
int disk = geo_map(i, start/chunk_size, raid_disks,
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: mdadm
Version: 4.1
Release: rc2.0.16
Release: rc2.0.17
Summary: The software RAID arrays user manage tools
License: GPLv2+
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
@ -33,6 +33,7 @@ Patch6019: 6019-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch
Patch6020: 6020-fix-NULL-dereference-in-super_by_fd.patch
Patch6021: 6021-Fix-memory-leak-after-mdadm-detail.patch
Patch6022: 6022-Fix-null-pointer-for-incremental-in-mdadm.patch
Patch6023: 6023-Fix-build-error-for-check.patch
BuildRequires: systemd gcc binutils
Requires(post): systemd coreutils
@ -58,6 +59,9 @@ This contains man files for the using of mdadm.
%build
%make_build CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon
%check
make test
%install
make DESTDIR=%{buildroot} MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} install install-systemd
install -Dp -m 755 misc/mdcheck %{buildroot}%{_sbindir}/mdcheck
@ -95,6 +99,9 @@ install -d -m 710 %{buildroot}/var/run/mdadm/
%{_mandir}/man*/*
%changelog
* Tue Mar 12 2024 wangxiaomeng <wangxiaomeng@kylinos.cn> - 4.1-rc2.0.17
- enable check
* Tue Sep 12 2023 miaoguanqin <miaoguanqin@huawei.com> - 4.1-rc2.0.16
- fix null pointer for incremental in mdadm