Merge pull request !165 from openeuler-sync-bot/sync-pr163-openEuler-22.03-LTS-to-openEuler-20.03-LTS-SP3
42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
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
|
|
|