!50 get instance correctly for eu-ar -N option and use make macros

From: @panxh_purple 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2022-08-26 08:26:16 +00:00 committed by Gitee
commit c48068f766
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 42 additions and 3 deletions

View File

@ -0,0 +1,34 @@
From 246d6d0ffcfe9ac6ef3581ca74399036aa827590 Mon Sep 17 00:00:00 2001
From: panxiaohe <panxh.life@foxmail.com>
Date: Fri, 12 Aug 2022 17:05:40 +0800
Subject: [PATCH] get instance correctly for eu-ar -N option
---
src/ar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ar.c b/src/ar.c
index 42126aa..f8166d3 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -518,7 +518,7 @@ do_oper_extract (int oper, const char *arfname, char **argv, int argc,
ENTRY entry;
entry.key = arhdr->ar_name;
ENTRY *res = hsearch (entry, FIND);
- if (res != NULL && (instance < 0 || instance-- == 0)
+ if (res != NULL && (instance < 0 || --instance == 0)
&& !found[(char **) res->data - argv])
found[(char **) res->data - argv] = do_extract = true;
}
@@ -952,7 +952,7 @@ do_oper_delete (const char *arfname, char **argv, int argc,
ENTRY entry;
entry.key = arhdr->ar_name;
ENTRY *res = hsearch (entry, FIND);
- if (res != NULL && (instance < 0 || instance-- == 0)
+ if (res != NULL && (instance < 0 || --instance == 0)
&& !found[(char **) res->data - argv])
found[(char **) res->data - argv] = do_delete = true;
}
--
2.27.0

View File

@ -1,7 +1,7 @@
# -*- rpm-spec from http://elfutils.org/ -*-
Name: elfutils
Version: 0.187
Release: 4
Release: 5
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
URL: http://elfutils.org/
License: GPLv3+ and (GPLv2+ or LGPLv3+)
@ -10,6 +10,7 @@ Source: ftp://sourceware.org/pub/elfutils/%{version}/elfutils-%{version}.tar.bz2
Patch0: Fix-segfault-in-eu-ar-m.patch
Patch1: Fix-error-of-parsing-object-file-perms.patch
Patch2: Fix-issue-of-moving-files-by-ar-or-br.patch
Patch3: Get-instance-correctly-for-eu-ar-N-option.patch
Requires: elfutils-libelf = %{version}-%{release}
Requires: elfutils-libs = %{version}-%{release}
@ -162,7 +163,7 @@ such servers to download those files on demand.
%build
%configure --program-prefix=%{_programprefix}
make -s %{?_smp_mflags}
%make_build
%install
rm -rf ${RPM_BUILD_ROOT}
@ -182,7 +183,7 @@ touch ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod/debuginfod.sqlite
%check
# run-debuginfod-find.sh is a bad test
make -s %{?_smp_mflags} check || (cat tests/test-suite.log; true)
%make_build check || (cat tests/test-suite.log; true)
%clean
rm -rf ${RPM_BUILD_ROOT}
@ -305,6 +306,10 @@ exit 0
%systemd_postun_with_restart debuginfod.service
%changelog
* Fri Aug 26 2022 panxiaohe <panxh.life@foxmail.com> - 0.187-5
- Get instance correctly for eu-ar -N option
- Use make macros
* Wed Aug 24 2022 yixiangzhike <yixiangzhike007@163.com> - 0.187-4
- Fix issue of moving files by ar or br