!165 [sync] PR-163: report low error of call cni plugin

Merge pull request !165 from openeuler-sync-bot/sync-pr163-openEuler-22.03-LTS-to-openEuler-20.03-LTS-SP3
This commit is contained in:
openeuler-sync-bot 2023-09-19 14:07:51 +00:00 committed by haozi007
parent 22f43a00d0
commit 6a86d064ef
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From b9793f6ce73cfa3788461b96081389f24dbd2467 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Wed, 13 Sep 2023 11:39:59 +0800
Subject: [PATCH 3/3] report low error of call cni plugin
Signed-off-by: haozi007 <liuhao27@huawei.com>
---
src/api.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/api.c b/src/api.c
index 4541496..0897869 100644
--- a/src/api.c
+++ b/src/api.c
@@ -303,16 +303,16 @@ static void format_invoke_err_msg(const char *name, int save_errno, char **err)
{
const char *invoke_err = get_invoke_err_msg(save_errno);
- if (asprintf(err, "find plugin: \"%s\" failed: %s", name, invoke_err != NULL ? invoke_err : "") < 0) {
- *err = clibcni_util_strdup_s("Out of memory");
+ if (invoke_err == NULL) {
+ // if not plugin error, only cause by no found plugin
+ invoke_err = "No such file or directory";
}
- if (invoke_err != NULL) {
- ERROR("find plugin: \"%s\" failed: %s", name, invoke_err);
- return;
+ if (asprintf(err, "find plugin: \"%s\" failed: %s", name, invoke_err) < 0) {
+ *err = clibcni_util_strdup_s("Out of memory");
}
- errno = save_errno;
- SYSERROR("find plugin: \"%s\" failed", name);
+
+ ERROR("find plugin: \"%s\" failed: %s", name, invoke_err);
}
static int run_cni_plugin(const struct network_config_list *list, size_t i, const char *operator,
--
2.34.1

View File

@ -1,5 +1,5 @@
%global _version 2.0.7
%global _release 7
%global _release 8
Name: clibcni
Version: %{_version}
Release: %{_release}
@ -12,6 +12,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}
Patch0001: 0001-46-Check-empty-pointer-before-referenced.patch
Patch0002: 0002-47-remove-unnecessary-strerror.patch
Patch0003: 0003-report-low-error-of-call-cni-plugin.patch
%define lcrver_lower 2.0.9-0
%define lcrver_upper 2.0.10-0
@ -91,6 +92,12 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Tue Sep 19 2023 jikai<jikai11@huawei.com> - 2.0.7-8
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:report low error of call cni plugin
* Tue Sep 12 2023 jikai<jikai11@huawei.com> - 2.0.7-7
- Type:bugfix
- CVE:NA