summaryrefslogtreecommitdiff
path: root/0011-remove-usage-of-strerror-with-user-defined-errno.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-10-16 08:21:17 +0000
committerCoprDistGit <infra@openeuler.org>2023-10-16 08:21:17 +0000
commit5a30c52fd5f03e11a1e7a998731c59a31477eba9 (patch)
tree6e73a07585bfafeae4404d2247436ed13d337457 /0011-remove-usage-of-strerror-with-user-defined-errno.patch
parentbe5fbac390ac42956df062b5585d96b3ae5db1df (diff)
automatic import of iSuladopeneuler23.09
Diffstat (limited to '0011-remove-usage-of-strerror-with-user-defined-errno.patch')
-rw-r--r--0011-remove-usage-of-strerror-with-user-defined-errno.patch891
1 files changed, 891 insertions, 0 deletions
diff --git a/0011-remove-usage-of-strerror-with-user-defined-errno.patch b/0011-remove-usage-of-strerror-with-user-defined-errno.patch
new file mode 100644
index 0000000..c21de08
--- /dev/null
+++ b/0011-remove-usage-of-strerror-with-user-defined-errno.patch
@@ -0,0 +1,891 @@
+From 16a4b6f334e4e81615a71cf7930158fb1bee5a12 Mon Sep 17 00:00:00 2001
+From: haozi007 <liuhao27@huawei.com>
+Date: Wed, 6 Sep 2023 15:05:29 +0800
+Subject: [PATCH 11/33] remove usage of strerror with user defined errno
+
+Signed-off-by: haozi007 <liuhao27@huawei.com>
+---
+ src/cmd/command_parser.c | 12 ++++++----
+ src/cmd/isula/base/create.c | 3 ++-
+ src/cmd/isula/isula_host_spec.c | 9 ++++---
+ src/cmd/isulad/main.c | 8 ++++---
+ src/cmd/options/opt_ulimit.c | 6 +++--
+ src/daemon/entry/cri/cni_network_plugin.cc | 9 ++++---
+ src/daemon/entry/cri/sysctl_tools.c | 14 +++++++----
+ .../v1/v1_cri_container_manager_service.cc | 4 ++--
+ .../v1/v1_cri_pod_sandbox_manager_service.cc | 3 ++-
+ src/daemon/executor/network_cb/network_cb.c | 6 +++--
+ src/daemon/modules/image/oci/oci_image.c | 6 +++--
+ .../oci/storage/image_store/image_store.c | 6 +++--
+ .../graphdriver/devmapper/deviceset.c | 19 +++++++++------
+ .../storage/layer_store/graphdriver/driver.c | 9 ++++---
+ .../graphdriver/overlay2/driver_overlay2.c | 17 ++++++++-----
+ .../oci/storage/layer_store/layer_store.c | 6 +++--
+ .../remote_layer_support/remote_support.c | 6 +++--
+ .../oci/storage/rootfs_store/rootfs_store.c | 6 +++--
+ .../modules/image/oci/storage/storage.c | 6 +++--
+ .../cni_operator/libcni/invoke/libcni_errno.c | 8 -------
+ .../cni_operator/libcni/invoke/libcni_errno.h | 2 --
+ .../cni_operator/libcni/libcni_cached.c | 3 ++-
+ .../modules/network/native/adaptor_native.c | 17 ++++++++-----
+ src/daemon/modules/plugin/plugin.c | 24 ++++++++++++-------
+ src/daemon/modules/service/service_network.c | 6 ++---
+ src/daemon/sandbox/sandbox.cc | 8 ++++---
+ src/utils/cutils/network_namespace.c | 3 ++-
+ src/utils/cutils/utils_file.c | 4 +++-
+ 28 files changed, 144 insertions(+), 86 deletions(-)
+
+diff --git a/src/cmd/command_parser.c b/src/cmd/command_parser.c
+index ac353b40..1ad1d92b 100644
+--- a/src/cmd/command_parser.c
++++ b/src/cmd/command_parser.c
+@@ -546,7 +546,8 @@ int command_convert_u16(command_option_t *option, const char *arg)
+ }
+ ret = util_safe_u16(arg, option->data);
+ if (ret != 0) {
+- COMMAND_ERROR("Invalid value \"%s\" for flag --%s: %s", arg, option->large, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Invalid value \"%s\" for flag --%s", arg, option->large);
+ return EINVALIDARGS;
+ }
+ return 0;
+@@ -561,7 +562,8 @@ int command_convert_llong(command_option_t *opt, const char *arg)
+ }
+ ret = util_safe_llong(arg, opt->data);
+ if (ret != 0) {
+- COMMAND_ERROR("Invalid value \"%s\" for flag --%s: %s", arg, opt->large, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Invalid value \"%s\" for flag --%s", arg, opt->large);
+ return EINVALIDARGS;
+ }
+ return 0;
+@@ -575,7 +577,8 @@ int command_convert_uint(command_option_t *opt, const char *arg)
+ }
+ ret = util_safe_uint(arg, opt->data);
+ if (ret != 0) {
+- COMMAND_ERROR("Invalid value \"%s\" for flag --%s: %s", arg, opt->large, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Invalid value \"%s\" for flag --%s", arg, opt->large);
+ return EINVALIDARGS;
+ }
+ return 0;
+@@ -590,7 +593,8 @@ int command_convert_int(command_option_t *option, const char *arg)
+ }
+ ret = util_safe_int(arg, option->data);
+ if (ret != 0) {
+- COMMAND_ERROR("Invalid value \"%s\" for flag --%s: %s", arg, option->large, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Invalid value \"%s\" for flag --%s", arg, option->large);
+ return EINVALIDARGS;
+ }
+ return 0;
+diff --git a/src/cmd/isula/base/create.c b/src/cmd/isula/base/create.c
+index aa90c5d6..cd0d4abd 100644
+--- a/src/cmd/isula/base/create.c
++++ b/src/cmd/isula/base/create.c
+@@ -2032,7 +2032,8 @@ static int create_check_hugetlbs(const struct client_arguments *args)
+ }
+ ret = util_parse_byte_size_string(limit, &limitvalue);
+ if (ret != 0) {
+- COMMAND_ERROR("Invalid hugetlb limit:%s:%s", limit, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Invalid hugetlb limit:%s", limit);
+ free(dup);
+ ret = -1;
+ goto out;
+diff --git a/src/cmd/isula/isula_host_spec.c b/src/cmd/isula/isula_host_spec.c
+index 9fa08bd2..6f39588d 100644
+--- a/src/cmd/isula/isula_host_spec.c
++++ b/src/cmd/isula/isula_host_spec.c
+@@ -66,7 +66,8 @@ static bool parse_restart_policy(const char *policy, host_config_restart_policy
+ }
+ nret = util_safe_int(dotpos, &(*rp)->maximum_retry_count);
+ if (nret != 0) {
+- COMMAND_ERROR("Maximum retry count must be an integer: %s", strerror(-nret));
++ errno = -nret;
++ CMD_SYSERROR("Maximum retry count must be an integer");
+ goto cleanup;
+ }
+ }
+@@ -724,7 +725,8 @@ static host_config_hugetlbs_element *pase_hugetlb_limit(const char *input)
+
+ ret = util_parse_byte_size_string(limit_value, &tconverted);
+ if (ret != 0 || tconverted < 0) {
+- COMMAND_ERROR("Parse limit value: %s failed:%s", limit_value, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Parse limit value: %s failed", limit_value);
+ goto free_out;
+ }
+ limit = (uint64_t)tconverted;
+@@ -733,7 +735,8 @@ static host_config_hugetlbs_element *pase_hugetlb_limit(const char *input)
+ tconverted = 0;
+ ret = util_parse_byte_size_string(pagesize, &tconverted);
+ if (ret != 0 || tconverted < 0) {
+- COMMAND_ERROR("Parse pagesize error.Invalid hugepage size: %s: %s", pagesize, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Parse pagesize error.Invalid hugepage size: %s", pagesize);
+ goto free_out;
+ }
+ page = (uint64_t)tconverted;
+diff --git a/src/cmd/isulad/main.c b/src/cmd/isulad/main.c
+index 39cde6aa..8369f9e2 100644
+--- a/src/cmd/isulad/main.c
++++ b/src/cmd/isulad/main.c
+@@ -632,8 +632,9 @@ static int parse_time_duration(const char *value, unsigned int *seconds)
+ *(num_str + len - 1) = '\0';
+ ret = util_safe_uint(num_str, &tmp);
+ if (ret < 0) {
+- ERROR("Illegal unsigned integer: %s", num_str);
+- COMMAND_ERROR("Illegal unsigned integer:%s:%s", num_str, strerror(-ret));
++ errno = -ret;
++ SYSERROR("Illegal unsigned integer: %s", num_str);
++ COMMAND_ERROR("Illegal unsigned integer:%s", num_str);
+ ret = -1;
+ goto out;
+ }
+@@ -1407,7 +1408,8 @@ static int create_mount_flock_file(const struct service_arguments *args)
+ // recreate mount flock file
+ // and make file uid/gid and permission correct
+ if (!util_force_remove_file(cleanpath, &err)) {
+- ERROR("Failed to delete %s, error: %s. Please delete %s manually.", path, strerror(err), path);
++ errno = err;
++ SYSERROR("Failed to delete %s. Please delete %s manually.", path, path);
+ return -1;
+ }
+ }
+diff --git a/src/cmd/options/opt_ulimit.c b/src/cmd/options/opt_ulimit.c
+index 55912a16..6853c0d9 100644
+--- a/src/cmd/options/opt_ulimit.c
++++ b/src/cmd/options/opt_ulimit.c
+@@ -63,7 +63,8 @@ static int parse_soft_hard_ulimit(const char *val, char **limitvals, size_t limi
+ // parse soft
+ ret = util_safe_llong(limitvals[0], &converted);
+ if (ret < 0) {
+- COMMAND_ERROR("Invalid ulimit soft value: \"%s\", parse int64 failed: %s", val, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Invalid ulimit soft value: \"%s\", parse int64 failed", val);
+ ret = -1;
+ goto out;
+ }
+@@ -74,7 +75,8 @@ static int parse_soft_hard_ulimit(const char *val, char **limitvals, size_t limi
+ converted = 0;
+ ret = util_safe_llong(limitvals[1], &converted);
+ if (ret < 0) {
+- COMMAND_ERROR("Invalid ulimit hard value: \"%s\", parse int64 failed: %s", val, strerror(-ret));
++ errno = -ret;
++ CMD_SYSERROR("Invalid ulimit hard value: \"%s\", parse int64 failed", val);
+ ret = -1;
+ goto out;
+ }
+diff --git a/src/daemon/entry/cri/cni_network_plugin.cc b/src/daemon/entry/cri/cni_network_plugin.cc
+index 1c7fea2e..c186d185 100644
+--- a/src/daemon/entry/cri/cni_network_plugin.cc
++++ b/src/daemon/entry/cri/cni_network_plugin.cc
+@@ -796,7 +796,8 @@ void CniNetworkPlugin::RLockNetworkMap(Errors &error)
+ int ret = pthread_rwlock_rdlock(&m_netsLock);
+ if (ret != 0) {
+ error.Errorf("Failed to get read lock");
+- ERROR("Get read lock failed: %s", strerror(ret));
++ errno = ret;
++ SYSERROR("Get read lock failed");
+ }
+ }
+
+@@ -805,7 +806,8 @@ void CniNetworkPlugin::WLockNetworkMap(Errors &error)
+ int ret = pthread_rwlock_wrlock(&m_netsLock);
+ if (ret != 0) {
+ error.Errorf("Failed to get write lock");
+- ERROR("Get write lock failed: %s", strerror(ret));
++ errno = ret;
++ SYSERROR("Get write lock failed");
+ }
+ }
+
+@@ -814,7 +816,8 @@ void CniNetworkPlugin::UnlockNetworkMap(Errors &error)
+ int ret = pthread_rwlock_unlock(&m_netsLock);
+ if (ret != 0) {
+ error.Errorf("Failed to unlock");
+- ERROR("Unlock failed: %s", strerror(ret));
++ errno = ret;
++ SYSERROR("Unlock failed");
+ }
+ }
+
+diff --git a/src/daemon/entry/cri/sysctl_tools.c b/src/daemon/entry/cri/sysctl_tools.c
+index 847c36e9..ac4fb226 100644
+--- a/src/daemon/entry/cri/sysctl_tools.c
++++ b/src/daemon/entry/cri/sysctl_tools.c
+@@ -22,6 +22,8 @@
+ #include <unistd.h>
+ #include <limits.h>
+
++#include <isula_libutils/log.h>
++
+ #include "utils.h"
+
+ int get_sysctl(const char *sysctl, char **err)
+@@ -41,14 +43,16 @@ int get_sysctl(const char *sysctl, char **err)
+ ret = -1;
+ fd = util_open(fullpath, O_RDONLY, 0);
+ if (fd < 0) {
+- if (asprintf(err, "Open %s failed: %s", sysctl, strerror(errno)) < 0) {
++ SYSWARN("Open %s failed", sysctl);
++ if (asprintf(err, "Open %s failed", sysctl) < 0) {
+ *err = util_strdup_s("Out of memory");
+ }
+ goto free_out;
+ }
+ rsize = util_read_nointr(fd, buff, sizeof(buff) - 1);
+ if (rsize <= 0) {
+- if (asprintf(err, "Read file failed: %s", strerror(errno)) < 0) {
++ SYSWARN("Read file: %s failed", sysctl);
++ if (asprintf(err, "Read file: %s failed", sysctl) < 0) {
+ *err = util_strdup_s("Out of memory");
+ }
+ goto free_out;
+@@ -93,14 +97,16 @@ int set_sysctl(const char *sysctl, int new_value, char **err)
+ ret = -1;
+ fd = util_open(fullpath, O_WRONLY, 0);
+ if (fd < 0) {
+- if (asprintf(err, "Open %s failed: %s", sysctl, strerror(errno)) < 0) {
++ SYSWARN("Open %s failed", sysctl);
++ if (asprintf(err, "Open %s failed", sysctl) < 0) {
+ *err = util_strdup_s("Out of memory");
+ }
+ goto free_out;
+ }
+ rsize = util_write_nointr(fd, buff, strlen(buff));
+ if (rsize < 0 || (size_t)rsize != strlen(buff)) {
+- if (asprintf(err, "Write new value failed: %s", strerror(errno)) < 0) {
++ SYSWARN("Write new value to %s failed", sysctl);
++ if (asprintf(err, "Write new value to %s failed", sysctl) < 0) {
+ *err = util_strdup_s("Out of memory");
+ }
+ goto free_out;
+diff --git a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
+index ecb7ffbd..daba21e4 100644
+--- a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
++++ b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
+@@ -497,8 +497,8 @@ void ContainerManagerService::CreateContainerLogSymlink(const std::string &conta
+ WARN("Deleted previously existing symlink file: %s", path);
+ }
+ if (symlink(realPath, path) != 0) {
+- error.Errorf("failed to create symbolic link %s to the container log file %s for container %s: %s", path,
+- realPath, containerID.c_str(), strerror(errno));
++ SYSERROR("failed to create symbolic link %s to the container log file %s for container %s", path, realPath, containerID.c_str());
++ error.Errorf("failed to create symbolic link %s to the container log file %s for container %s", path, realPath, containerID.c_str());
+ goto cleanup;
+ }
+ } else {
+diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
+index d57338c8..41a02c54 100644
+--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
++++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
+@@ -429,7 +429,8 @@ void PodSandboxManagerService::ClearCniNetwork(const std::shared_ptr<sandbox::Sa
+
+ // umount netns when cni removed network successfully
+ if (remove_network_namespace(sandboxKey.c_str()) != 0) {
+- error.Errorf("Failed to umount directory %s:%s", sandboxKey.c_str(), strerror(errno));
++ SYSERROR("Failed to umount directory %s", sandboxKey.c_str());
++ error.Errorf("Failed to umount directory %s", sandboxKey.c_str());
+ }
+ }
+
+diff --git a/src/daemon/executor/network_cb/network_cb.c b/src/daemon/executor/network_cb/network_cb.c
+index e4f9ce3f..d0f361d0 100644
+--- a/src/daemon/executor/network_cb/network_cb.c
++++ b/src/daemon/executor/network_cb/network_cb.c
+@@ -43,7 +43,8 @@ static inline bool network_conflist_lock(enum lock_type type)
+ nret = pthread_rwlock_wrlock(&g_network_rwlock);
+ }
+ if (nret != 0) {
+- ERROR("Lock network list failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock network list failed");
+ return false;
+ }
+
+@@ -56,7 +57,8 @@ static inline void network_conflist_unlock()
+
+ nret = pthread_rwlock_unlock(&g_network_rwlock);
+ if (nret != 0) {
+- FATAL("Unlock network list failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock network list failed");
+ }
+ }
+
+diff --git a/src/daemon/modules/image/oci/oci_image.c b/src/daemon/modules/image/oci/oci_image.c
+index 40e9a88f..4a48016b 100644
+--- a/src/daemon/modules/image/oci/oci_image.c
++++ b/src/daemon/modules/image/oci/oci_image.c
+@@ -59,7 +59,8 @@ static inline bool oci_remote_lock(pthread_rwlock_t *remote_lock, bool writable)
+ nret = pthread_rwlock_rdlock(remote_lock);
+ }
+ if (nret != 0) {
+- ERROR("Lock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock memory store failed");
+ return false;
+ }
+
+@@ -72,7 +73,8 @@ static inline void oci_remote_unlock(pthread_rwlock_t *remote_lock)
+
+ nret = pthread_rwlock_unlock(remote_lock);
+ if (nret != 0) {
+- FATAL("Unlock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock memory store failed");
+ }
+ }
+ #endif
+diff --git a/src/daemon/modules/image/oci/storage/image_store/image_store.c b/src/daemon/modules/image/oci/storage/image_store/image_store.c
+index e9adab1a..55e3bb97 100644
+--- a/src/daemon/modules/image/oci/storage/image_store/image_store.c
++++ b/src/daemon/modules/image/oci/storage/image_store/image_store.c
+@@ -94,7 +94,8 @@ static inline bool image_store_lock(enum lock_type type)
+ nret = pthread_rwlock_wrlock(&g_image_store->rwlock);
+ }
+ if (nret != 0) {
+- ERROR("Lock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock memory store failed");
+ return false;
+ }
+
+@@ -107,7 +108,8 @@ static inline void image_store_unlock()
+
+ nret = pthread_rwlock_unlock(&g_image_store->rwlock);
+ if (nret != 0) {
+- FATAL("Unlock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock memory store failed");
+ }
+ }
+
+diff --git a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c
+index 81e53ea7..4f19c26d 100644
+--- a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c
++++ b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c
+@@ -107,8 +107,9 @@ static int handle_dm_min_free_space(char *val, struct device_set *devset)
+ int ret = util_parse_percent_string(val, &converted);
+
+ if (ret != 0 || converted >= 100) {
+- ERROR("Invalid min free space: '%s': %s", val, strerror(-ret));
+- isulad_set_error_message("Invalid min free space: '%s': %s", val, strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid min free space: '%s'", val);
++ isulad_set_error_message("Invalid min free space: '%s'", val);
+ return -1;
+ }
+ devset->min_free_space_percent = (uint32_t)converted;
+@@ -122,8 +123,9 @@ static int handle_dm_basesize(char *val, struct device_set *devset)
+ int ret = util_parse_byte_size_string(val, &converted);
+
+ if (ret != 0) {
+- ERROR("Invalid size: '%s': %s", val, strerror(-ret));
+- isulad_set_error_message("Invalid size: '%s': %s", val, strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid size: '%s'", val);
++ isulad_set_error_message("Invalid size: '%s'", val);
+ return -1;
+ }
+ if (converted <= 0) {
+@@ -2722,7 +2724,8 @@ static int determine_driver_capabilities(const char *version, struct device_set
+
+ ret = util_parse_byte_size_string(tmp_str[0], &major);
+ if (ret != 0) {
+- ERROR("devmapper: invalid size: '%s': %s", tmp_str[0], strerror(-ret));
++ errno = -ret;
++ SYSERROR("devmapper: invalid size: '%s'", tmp_str[0]);
+ ret = -1;
+ goto out;
+ }
+@@ -2742,7 +2745,8 @@ static int determine_driver_capabilities(const char *version, struct device_set
+
+ ret = util_parse_byte_size_string(tmp_str[1], &minor);
+ if (ret != 0) {
+- ERROR("devmapper: invalid size: '%s': %s", tmp_str[1], strerror(-ret));
++ errno = -ret;
++ SYSERROR("devmapper: invalid size: '%s'", tmp_str[1]);
+ ret = -1;
+ goto out;
+ }
+@@ -2915,7 +2919,8 @@ static int parse_storage_opt(const json_map_string_string *opts, uint64_t *size)
+
+ ret = util_parse_byte_size_string(opts->values[i], &converted);
+ if (ret != 0) {
+- ERROR("Invalid size: '%s': %s", opts->values[i], strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid size: '%s'", opts->values[i]);
+ ret = -1;
+ goto out;
+ }
+diff --git a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c
+index b83c63b1..b1790af1 100644
+--- a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c
++++ b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c
+@@ -86,7 +86,8 @@ static inline bool driver_rd_lock()
+
+ nret = pthread_rwlock_rdlock(&g_graphdriver->rwlock);
+ if (nret != 0) {
+- ERROR("Lock driver memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock driver memory store failed");
+ return false;
+ }
+
+@@ -99,7 +100,8 @@ static inline bool driver_wr_lock()
+
+ nret = pthread_rwlock_wrlock(&g_graphdriver->rwlock);
+ if (nret != 0) {
+- ERROR("Lock driver memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock driver memory store failed");
+ return false;
+ }
+
+@@ -112,7 +114,8 @@ static inline void driver_unlock()
+
+ nret = pthread_rwlock_unlock(&g_graphdriver->rwlock);
+ if (nret != 0) {
+- FATAL("Unlock driver memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock driver memory store failed");
+ }
+ }
+
+diff --git a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/overlay2/driver_overlay2.c b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/overlay2/driver_overlay2.c
+index b177f594..3b27076c 100644
+--- a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/overlay2/driver_overlay2.c
++++ b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/overlay2/driver_overlay2.c
+@@ -134,7 +134,8 @@ static int overlay2_parse_options(struct graphdriver *driver, const char **optio
+ int64_t converted = 0;
+ ret = util_parse_byte_size_string(val, &converted);
+ if (ret != 0) {
+- ERROR("Invalid size: '%s': %s", val, strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid size: '%s'", val);
+ ret = -1;
+ goto out;
+ }
+@@ -143,7 +144,8 @@ static int overlay2_parse_options(struct graphdriver *driver, const char **optio
+ int64_t converted = 0;
+ ret = util_parse_byte_size_string(val, &converted);
+ if (ret != 0) {
+- ERROR("Invalid size: '%s': %s", val, strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid size: '%s'", val);
+ ret = -1;
+ goto out;
+ }
+@@ -152,7 +154,8 @@ static int overlay2_parse_options(struct graphdriver *driver, const char **optio
+ bool converted_bool = 0;
+ ret = util_str_to_bool(val, &converted_bool);
+ if (ret != 0) {
+- ERROR("Invalid bool: '%s': %s", val, strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid bool: '%s'", val);
+ ret = -1;
+ goto out;
+ }
+@@ -161,7 +164,8 @@ static int overlay2_parse_options(struct graphdriver *driver, const char **optio
+ bool converted_bool = 0;
+ ret = util_str_to_bool(val, &converted_bool);
+ if (ret != 0) {
+- ERROR("Invalid bool: '%s': %s", val, strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid bool: '%s'", val);
+ ret = -1;
+ goto out;
+ }
+@@ -830,8 +834,9 @@ static int set_layer_quota(const char *dir, const json_map_string_string *opts,
+ int64_t converted = 0;
+ ret = util_parse_byte_size_string(opts->values[i], &converted);
+ if (ret != 0) {
+- ERROR("Invalid size: '%s': %s", opts->values[i], strerror(-ret));
+- isulad_set_error_message("Invalid quota size: '%s': %s", opts->values[i], strerror(-ret));
++ errno = -ret;
++ SYSERROR("Invalid size: '%s'", opts->values[i]);
++ isulad_set_error_message("Invalid quota size: '%s'", opts->values[i]);
+ ret = -1;
+ goto out;
+ }
+diff --git a/src/daemon/modules/image/oci/storage/layer_store/layer_store.c b/src/daemon/modules/image/oci/storage/layer_store/layer_store.c
+index ddf3a62c..8d8384b8 100644
+--- a/src/daemon/modules/image/oci/storage/layer_store/layer_store.c
++++ b/src/daemon/modules/image/oci/storage/layer_store/layer_store.c
+@@ -98,7 +98,8 @@ static inline bool layer_store_lock(bool writable)
+ nret = pthread_rwlock_rdlock(&g_metadata.rwlock);
+ }
+ if (nret != 0) {
+- ERROR("Lock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock memory store failed");
+ return false;
+ }
+
+@@ -111,7 +112,8 @@ static inline void layer_store_unlock()
+
+ nret = pthread_rwlock_unlock(&g_metadata.rwlock);
+ if (nret != 0) {
+- FATAL("Unlock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock memory store failed");
+ }
+ }
+
+diff --git a/src/daemon/modules/image/oci/storage/remote_layer_support/remote_support.c b/src/daemon/modules/image/oci/storage/remote_layer_support/remote_support.c
+index 400678c4..1bac8dd5 100644
+--- a/src/daemon/modules/image/oci/storage/remote_layer_support/remote_support.c
++++ b/src/daemon/modules/image/oci/storage/remote_layer_support/remote_support.c
+@@ -39,7 +39,8 @@ static inline bool remote_refresh_lock(pthread_rwlock_t *remote_lock, bool writa
+ nret = pthread_rwlock_rdlock(remote_lock);
+ }
+ if (nret != 0) {
+- ERROR("Lock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock memory store failed");
+ return false;
+ }
+
+@@ -52,7 +53,8 @@ static inline void remote_refresh_unlock(pthread_rwlock_t *remote_lock)
+
+ nret = pthread_rwlock_unlock(remote_lock);
+ if (nret != 0) {
+- FATAL("Unlock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock memory store failed");
+ }
+ }
+
+diff --git a/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c b/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
+index 1c5d2d84..ee1e15d0 100644
+--- a/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
++++ b/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
+@@ -69,7 +69,8 @@ static inline bool rootfs_store_lock(enum lock_type type)
+ }
+
+ if (nret != 0) {
+- ERROR("Lock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock memory store failed");
+ return false;
+ }
+
+@@ -82,7 +83,8 @@ static inline void rootfs_store_unlock()
+
+ nret = pthread_rwlock_unlock(&g_rootfs_store->rwlock);
+ if (nret != 0) {
+- FATAL("Unlock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock memory store failed");
+ }
+ }
+
+diff --git a/src/daemon/modules/image/oci/storage/storage.c b/src/daemon/modules/image/oci/storage/storage.c
+index d5e79207..aa442ecf 100644
+--- a/src/daemon/modules/image/oci/storage/storage.c
++++ b/src/daemon/modules/image/oci/storage/storage.c
+@@ -61,7 +61,8 @@ static inline bool storage_lock(pthread_rwlock_t *store_lock, bool writable)
+ nret = pthread_rwlock_rdlock(store_lock);
+ }
+ if (nret != 0) {
+- ERROR("Lock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock memory store failed");
+ return false;
+ }
+
+@@ -74,7 +75,8 @@ static inline void storage_unlock(pthread_rwlock_t *store_lock)
+
+ nret = pthread_rwlock_unlock(store_lock);
+ if (nret != 0) {
+- FATAL("Unlock memory store failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock memory store failed");
+ }
+ }
+
+diff --git a/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.c b/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.c
+index efdcfbc7..977f9fbb 100644
+--- a/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.c
++++ b/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.c
+@@ -30,14 +30,6 @@ const char * const g_INVOKE_ERR_MSGS[] = {
+ "Success"
+ };
+
+-const char *get_invoke_err_msg(int errcode)
+-{
+- if (errcode > (int)INK_ERR_MIN && errcode <= (int)INK_ERR_SUCCESS) {
+- return g_INVOKE_ERR_MSGS[errcode - (int)INK_ERR_MIN];
+- }
+- return strerror(errcode);
+-}
+-
+ const char * const g_CNI_WELL_KNOWN_ERR_MSGS[] = {
+ /* 0 */
+ "Success",
+diff --git a/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.h b/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.h
+index 9f63e5f5..236bc6ef 100644
+--- a/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.h
++++ b/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_errno.h
+@@ -43,8 +43,6 @@ enum CNI_CUSTOM_ERROR {
+ CUSTOM_ERR_MAX, // max flag
+ };
+
+-const char *get_invoke_err_msg(int errcode);
+-
+ enum CNI_WELL_KNOW_ERROR {
+ CNI_ERR_UNKNOW = 0,
+ CNI_ERR_INCOMPATIBLE_CNI_VERSION,
+diff --git a/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c b/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c
+index 63ee6e10..17de527e 100644
+--- a/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c
++++ b/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c
+@@ -276,7 +276,8 @@ int cni_cache_delete(const char *cache_dir, const char *net_name, const struct r
+ }
+
+ if (!util_force_remove_file(file_path, &get_err)) {
+- ERROR("Failed to delete %s, error: %s", file_path, strerror(get_err));
++ errno = get_err;
++ SYSERROR("Failed to delete %s.", file_path);
+ }
+
+ free(file_path);
+diff --git a/src/daemon/modules/network/native/adaptor_native.c b/src/daemon/modules/network/native/adaptor_native.c
+index 8bc386d1..8d403442 100644
+--- a/src/daemon/modules/network/native/adaptor_native.c
++++ b/src/daemon/modules/network/native/adaptor_native.c
+@@ -86,7 +86,8 @@ static inline bool native_store_lock(enum lock_type type)
+ nret = pthread_rwlock_wrlock(&g_store.rwlock);
+ }
+ if (nret != 0) {
+- ERROR("Lock network list failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock network list failed");
+ return false;
+ }
+
+@@ -99,7 +100,8 @@ static inline void native_store_unlock()
+
+ nret = pthread_rwlock_unlock(&g_store.rwlock);
+ if (nret != 0) {
+- FATAL("Unlock network list failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock network list failed");
+ }
+ }
+
+@@ -113,7 +115,8 @@ static inline void native_network_lock(enum lock_type type, native_network *netw
+ nret = pthread_rwlock_wrlock(&network->rwlock);
+ }
+ if (nret != 0) {
+- ERROR("Lock network list failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Lock network list failed");
+ }
+ }
+
+@@ -123,7 +126,8 @@ static inline void native_network_unlock(native_network *network)
+
+ nret = pthread_rwlock_unlock(&network->rwlock);
+ if (nret != 0) {
+- FATAL("Unlock network list failed: %s", strerror(nret));
++ errno = nret;
++ SYSERROR("Unlock network list failed");
+ }
+ }
+
+@@ -1944,8 +1948,9 @@ int native_config_remove(const char *name, char **res_name)
+ WARN("Failed to get %s file path", network->conflist->list->name);
+ isulad_append_error_message("Failed to get %s file path. ", network->conflist->list->name);
+ } else if (!util_force_remove_file(path, &get_err)) {
+- WARN("Failed to delete %s, error: %s", path, strerror(get_err));
+- isulad_append_error_message("Failed to delete %s, error: %s. ", path, strerror(get_err));
++ errno = get_err;
++ SYSWARN("Failed to delete %s.", path);
++ isulad_append_error_message("Failed to delete %s.", path);
+ }
+
+ if (!map_remove(g_store.name_to_network, (void *)network->conflist->list->name)) {
+diff --git a/src/daemon/modules/plugin/plugin.c b/src/daemon/modules/plugin/plugin.c
+index b4d78dc9..c42cfd21 100644
+--- a/src/daemon/modules/plugin/plugin.c
++++ b/src/daemon/modules/plugin/plugin.c
+@@ -409,7 +409,8 @@ static void pm_rdlock(void)
+
+ errcode = pthread_rwlock_rdlock(&g_plugin_manager->pm_rwlock);
+ if (errcode != 0) {
+- ERROR("Read lock failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Read lock failed");
+ }
+ }
+
+@@ -419,7 +420,8 @@ static void pm_wrlock(void)
+
+ errcode = pthread_rwlock_wrlock(&g_plugin_manager->pm_rwlock);
+ if (errcode != 0) {
+- ERROR("Write lock failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Write lock failed");
+ }
+ }
+
+@@ -429,7 +431,8 @@ static void pm_unlock(void)
+
+ errcode = pthread_rwlock_unlock(&g_plugin_manager->pm_rwlock);
+ if (errcode != 0) {
+- ERROR("Unlock failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Unlock failed");
+ }
+ }
+
+@@ -659,7 +662,8 @@ static void *plugin_manager_routine(void *arg)
+
+ errcode = pthread_detach(pthread_self());
+ if (errcode != 0) {
+- ERROR("Detach thread failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Detach thread failed");
+ return NULL;
+ }
+ if (pm_init() < 0) {
+@@ -716,7 +720,8 @@ static void plugin_rdlock(plugin_t *plugin)
+
+ errcode = pthread_rwlock_rdlock(&plugin->lock);
+ if (errcode != 0) {
+- ERROR("Plugin read lock failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Plugin read lock failed");
+ }
+ }
+
+@@ -726,7 +731,8 @@ static void plugin_wrlock(plugin_t *plugin)
+
+ errcode = pthread_rwlock_wrlock(&plugin->lock);
+ if (errcode != 0) {
+- ERROR("Plugin write lock failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Plugin write lock failed");
+ }
+ }
+
+@@ -736,7 +742,8 @@ static void plugin_unlock(plugin_t *plugin)
+
+ errcode = pthread_rwlock_unlock(&plugin->lock);
+ if (errcode != 0) {
+- ERROR("Plugin unlock failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Plugin unlock failed");
+ }
+ }
+
+@@ -758,7 +765,8 @@ plugin_t *plugin_new(const char *name, const char *addr)
+
+ errcode = pthread_rwlock_init(&plugin->lock, NULL);
+ if (errcode != 0) {
+- ERROR("Plugin init lock failed: %s", strerror(errcode));
++ errno = errcode;
++ SYSERROR("Plugin init lock failed");
+ goto bad;
+ }
+ plugin->name = util_strdup_s(name);
+diff --git a/src/daemon/modules/service/service_network.c b/src/daemon/modules/service/service_network.c
+index 5502bcbd..6754cf1a 100644
+--- a/src/daemon/modules/service/service_network.c
++++ b/src/daemon/modules/service/service_network.c
+@@ -962,7 +962,7 @@ static int do_update_internal_file(const char *id, const char *file_path,
+ ret = 0;
+ } else {
+ SYSERROR("Failed to write file %s", file_path);
+- isulad_set_error_message("Failed to write file %s: %s", file_path, strerror(errno));
++ isulad_set_error_message("Failed to write file %s", file_path);
+ ret = -1;
+ }
+
+@@ -1180,7 +1180,7 @@ static int do_drop_internal_file(const char *id, const char *file_path, const de
+ goto out;
+ } else {
+ SYSERROR("Failed to open %s", file_path);
+- isulad_set_error_message("Failed to open %s: %s", file_path, strerror(errno));
++ isulad_set_error_message("Failed to open %s", file_path);
+ ret = -1;
+ goto out;
+ }
+@@ -1213,7 +1213,7 @@ static int do_drop_internal_file(const char *id, const char *file_path, const de
+ ret = util_write_file(file_path, str, strlen(str), NETWORK_MOUNT_FILE_MODE);
+ if (ret != 0) {
+ SYSERROR("Failed to write file %s", file_path);
+- isulad_set_error_message("Failed to write file %s: %s", file_path, strerror(errno));
++ isulad_set_error_message("Failed to write file %s", file_path);
+ goto out;
+ }
+
+diff --git a/src/daemon/sandbox/sandbox.cc b/src/daemon/sandbox/sandbox.cc
+index d3fc7eea..1723e95e 100644
+--- a/src/daemon/sandbox/sandbox.cc
++++ b/src/daemon/sandbox/sandbox.cc
+@@ -817,7 +817,8 @@ auto Sandbox::SaveState(Errors &error) -> bool
+
+ nret = util_atomic_write_file(path.c_str(), stateJson.c_str(), stateJson.length(), CONFIG_FILE_MODE, false);
+ if (nret != 0) {
+- error.Errorf("Failed to write file %s: %s", path.c_str(), strerror(errno));
++ SYSERROR("Failed to write file %s");
++ error.Errorf("Failed to write file %s", path.c_str());
+ return false;
+ }
+
+@@ -834,7 +835,7 @@ auto Sandbox::SaveNetworkSetting(Errors &error) -> bool
+ false);
+ if (nret != 0) {
+ SYSERROR("Failed to write file %s", path.c_str());
+- error.Errorf("Failed to write file %s: %s", path.c_str(), strerror(errno));
++ error.Errorf("Failed to write file %s", path.c_str());
+ return false;
+ }
+
+@@ -877,7 +878,8 @@ auto Sandbox::SaveMetadata(Errors &error) -> bool
+
+ nret = util_atomic_write_file(path.c_str(), metadataJson.c_str(), metadataJson.length(), CONFIG_FILE_MODE, false);
+ if (nret != 0) {
+- error.Errorf("Failed to write file %s: %s", path.c_str(), strerror(errno));
++ SYSERROR("Failed to write file %s", path.c_str());
++ error.Errorf("Failed to write file %s", path.c_str());
+ return false;
+ }
+ return true;
+diff --git a/src/utils/cutils/network_namespace.c b/src/utils/cutils/network_namespace.c
+index 0e225d9b..c9838104 100644
+--- a/src/utils/cutils/network_namespace.c
++++ b/src/utils/cutils/network_namespace.c
+@@ -231,7 +231,8 @@ int remove_network_namespace_file(const char *netns_path)
+ }
+
+ if (!util_force_remove_file(netns_path, &get_err)) {
+- ERROR("Failed to remove file %s, error: %s", netns_path, strerror(get_err));
++ errno = get_err;
++ SYSERROR("Failed to remove file %s", netns_path);
+ return -1;
+ }
+
+diff --git a/src/utils/cutils/utils_file.c b/src/utils/cutils/utils_file.c
+index bc22ee95..1a148b0b 100644
+--- a/src/utils/cutils/utils_file.c
++++ b/src/utils/cutils/utils_file.c
+@@ -1061,7 +1061,9 @@ char *look_path(const char *file, char **err)
+ if (en == 0) {
+ return util_strdup_s(file);
+ }
+- if (asprintf(err, "find exec %s : %s", file, strerror(en)) < 0) {
++ errno = en;
++ SYSERROR("find exec %s failed", file);
++ if (asprintf(err, "find exec %s failed", file) < 0) {
+ *err = util_strdup_s("Out of memory");
+ }
+ return NULL;
+--
+2.40.1
+