230 lines
9.3 KiB
Diff
230 lines
9.3 KiB
Diff
From 9c97c74fe3e384e5fe87c80037f94544a4b45081 Mon Sep 17 00:00:00 2001
|
|
From: haozi007 <liuhao27@huawei.com>
|
|
Date: Wed, 6 Sep 2023 10:26:25 +0800
|
|
Subject: [PATCH 138/145] replace COMMAND_ERROR to CMD_SYSERROR
|
|
|
|
Signed-off-by: haozi007 <liuhao27@huawei.com>
|
|
---
|
|
src/cmd/isula/base/create.c | 4 ++--
|
|
src/cmd/isula/extend/export.c | 2 +-
|
|
src/cmd/isula/images/import.c | 2 +-
|
|
src/cmd/isula/images/load.c | 2 +-
|
|
src/cmd/isula/images/login.c | 6 +++---
|
|
src/cmd/isula/stream/attach.c | 2 +-
|
|
src/cmd/isulad/main.c | 2 +-
|
|
.../executor/container_cb/execution_information.c | 2 +-
|
|
src/daemon/modules/log/log_gather.c | 14 +++++++-------
|
|
src/utils/console/console.c | 2 +-
|
|
10 files changed, 19 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/src/cmd/isula/base/create.c b/src/cmd/isula/base/create.c
|
|
index 8cef5d17..02838a56 100644
|
|
--- a/src/cmd/isula/base/create.c
|
|
+++ b/src/cmd/isula/base/create.c
|
|
@@ -1758,7 +1758,7 @@ static int check_hook_spec_file(const char *hook_spec)
|
|
return -1;
|
|
}
|
|
if (stat(hook_spec, &hookstat)) {
|
|
- COMMAND_ERROR("Stat hook spec file failed: %s", strerror(errno));
|
|
+ CMD_SYSERROR("Stat hook spec file failed");
|
|
return -1;
|
|
}
|
|
if ((hookstat.st_mode & S_IFMT) != S_IFREG) {
|
|
@@ -1800,7 +1800,7 @@ static int create_check_rootfs(struct client_arguments *args)
|
|
if (args->create_rootfs != NULL) {
|
|
char real_path[PATH_MAX] = { 0 };
|
|
if (realpath(args->create_rootfs, real_path) == NULL) {
|
|
- COMMAND_ERROR("Failed to get rootfs '%s': %s", args->create_rootfs, strerror(errno));
|
|
+ CMD_SYSERROR("Failed to get rootfs '%s'.", args->create_rootfs);
|
|
ret = -1;
|
|
goto out;
|
|
}
|
|
diff --git a/src/cmd/isula/extend/export.c b/src/cmd/isula/extend/export.c
|
|
index 68d17c82..34ab1885 100644
|
|
--- a/src/cmd/isula/extend/export.c
|
|
+++ b/src/cmd/isula/extend/export.c
|
|
@@ -114,7 +114,7 @@ int cmd_export_main(int argc, const char **argv)
|
|
int sret;
|
|
char cwd[PATH_MAX] = { 0 };
|
|
if (!getcwd(cwd, sizeof(cwd))) {
|
|
- COMMAND_ERROR("get cwd failed:%s", strerror(errno));
|
|
+ CMD_SYSERROR("get cwd failed.");
|
|
exit(ECOMMON);
|
|
}
|
|
sret = snprintf(file, sizeof(file), "%s/%s", cwd, g_cmd_export_args.file);
|
|
diff --git a/src/cmd/isula/images/import.c b/src/cmd/isula/images/import.c
|
|
index 7b6eb2a9..98805c95 100644
|
|
--- a/src/cmd/isula/images/import.c
|
|
+++ b/src/cmd/isula/images/import.c
|
|
@@ -126,7 +126,7 @@ int cmd_import_main(int argc, const char **argv)
|
|
int len = 0;
|
|
|
|
if (!getcwd(cwd, sizeof(cwd))) {
|
|
- COMMAND_ERROR("get cwd failed:%s", strerror(errno));
|
|
+ CMD_SYSERROR("get cwd failed.");
|
|
exit(exit_code);
|
|
}
|
|
|
|
diff --git a/src/cmd/isula/images/load.c b/src/cmd/isula/images/load.c
|
|
index 688edd02..48422438 100644
|
|
--- a/src/cmd/isula/images/load.c
|
|
+++ b/src/cmd/isula/images/load.c
|
|
@@ -150,7 +150,7 @@ int cmd_load_main(int argc, const char **argv)
|
|
int len;
|
|
|
|
if (!getcwd(cwd, sizeof(cwd))) {
|
|
- COMMAND_ERROR("get cwd failed:%s", strerror(errno));
|
|
+ CMD_SYSERROR("get cwd failed.");
|
|
exit(exit_code);
|
|
}
|
|
|
|
diff --git a/src/cmd/isula/images/login.c b/src/cmd/isula/images/login.c
|
|
index c35cb579..1c3b06ea 100644
|
|
--- a/src/cmd/isula/images/login.c
|
|
+++ b/src/cmd/isula/images/login.c
|
|
@@ -99,7 +99,7 @@ static int get_password_from_notty(struct client_arguments *args)
|
|
return -1;
|
|
}
|
|
if (n < 0) {
|
|
- COMMAND_ERROR("Get password from notty stdin failed: %s", strerror(errno));
|
|
+ CMD_SYSERROR("Get password from notty stdin failed");
|
|
return -1;
|
|
}
|
|
args->password = util_strdup_s(password);
|
|
@@ -126,7 +126,7 @@ static int get_auth_from_terminal(struct client_arguments *args)
|
|
COMMAND_ERROR("Error: Cannot perform an interactive login from a non TTY device");
|
|
return -1;
|
|
}
|
|
- COMMAND_ERROR("Get username failed: %s", strerror(errno));
|
|
+ CMD_SYSERROR("Get username failed");
|
|
return -1;
|
|
}
|
|
args->username = util_strdup_s(username);
|
|
@@ -145,7 +145,7 @@ static int get_auth_from_terminal(struct client_arguments *args)
|
|
COMMAND_ERROR("Error: Cannot perform an interactive login from a non TTY device");
|
|
return -1;
|
|
}
|
|
- COMMAND_ERROR("Get password failed: %s", strerror(errno));
|
|
+ CMD_SYSERROR("Get password failed");
|
|
return -1;
|
|
}
|
|
args->password = util_strdup_s(password);
|
|
diff --git a/src/cmd/isula/stream/attach.c b/src/cmd/isula/stream/attach.c
|
|
index 02c67e30..ff49af92 100644
|
|
--- a/src/cmd/isula/stream/attach.c
|
|
+++ b/src/cmd/isula/stream/attach.c
|
|
@@ -376,7 +376,7 @@ static int client_attach(struct client_arguments *args, uint32_t *exit_code)
|
|
if (errno == ETIMEDOUT) {
|
|
COMMAND_ERROR("Wait container status timeout.");
|
|
} else {
|
|
- COMMAND_ERROR("Failed to wait sem: %s", strerror(errno));
|
|
+ CMD_SYSERROR("Failed to wait sem");
|
|
}
|
|
ret = ECOMMON;
|
|
goto out;
|
|
diff --git a/src/cmd/isulad/main.c b/src/cmd/isulad/main.c
|
|
index f2a25a84..1906feaf 100644
|
|
--- a/src/cmd/isulad/main.c
|
|
+++ b/src/cmd/isulad/main.c
|
|
@@ -1712,7 +1712,7 @@ static int set_locale()
|
|
|
|
/* Change from the standard (C) to en_US.UTF-8 locale, so libarchive can handle filename conversions.*/
|
|
if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) {
|
|
- COMMAND_ERROR("Could not set locale to en_US.UTF-8:%s", strerror(errno));
|
|
+ CMD_SYSERROR("Could not set locale to en_US.UTF-8");
|
|
ret = -1;
|
|
goto out;
|
|
}
|
|
diff --git a/src/daemon/executor/container_cb/execution_information.c b/src/daemon/executor/container_cb/execution_information.c
|
|
index 6d9521ec..ba33bdfa 100644
|
|
--- a/src/daemon/executor/container_cb/execution_information.c
|
|
+++ b/src/daemon/executor/container_cb/execution_information.c
|
|
@@ -589,7 +589,7 @@ void execute_ps_command(char **args, const char *pid_args, size_t args_len)
|
|
|
|
execvp("ps", params);
|
|
|
|
- COMMAND_ERROR("Cannot get ps info with '%s':%s", pid_args, strerror(errno));
|
|
+ CMD_SYSERROR("Cannot get ps info with '%s'.", pid_args);
|
|
|
|
out:
|
|
exit(EXIT_FAILURE);
|
|
diff --git a/src/daemon/modules/log/log_gather.c b/src/daemon/modules/log/log_gather.c
|
|
index 780034ee..41c02758 100644
|
|
--- a/src/daemon/modules/log/log_gather.c
|
|
+++ b/src/daemon/modules/log/log_gather.c
|
|
@@ -142,7 +142,7 @@ static int create_fifo()
|
|
|
|
ret = mknod(g_fifo_path, S_IFIFO | S_IRUSR | S_IWUSR, (dev_t)0);
|
|
if (ret != 0 && errno != EEXIST) {
|
|
- COMMAND_ERROR("mknod failed: %s", strerror(errno));
|
|
+ CMD_SYSERROR("mknod failed.");
|
|
} else {
|
|
ret = 0;
|
|
}
|
|
@@ -157,12 +157,12 @@ static int open_log(bool change_size)
|
|
|
|
fd = util_open(g_fifo_path, O_RDWR | O_CLOEXEC, 0);
|
|
if (fd == -1) {
|
|
- COMMAND_ERROR("open fifo %s failed: %s", g_fifo_path, strerror(errno));
|
|
+ CMD_SYSERROR("open fifo %s failed", g_fifo_path);
|
|
return fd;
|
|
}
|
|
|
|
if (change_size && fcntl(fd, F_SETPIPE_SZ, LOG_FIFO_SIZE) == -1) {
|
|
- COMMAND_ERROR("set fifo buffer size failed: %s", strerror(errno));
|
|
+ CMD_SYSERROR("set fifo buffer size failed");
|
|
close(fd);
|
|
return -1;
|
|
}
|
|
@@ -262,7 +262,7 @@ void main_loop()
|
|
int len = (int)util_read_nointr(g_fifo_fd, rev_buf, REV_BUF_SIZE);
|
|
if (len < 0) {
|
|
if (ecount < 2) {
|
|
- COMMAND_ERROR("%d: Read message failed: %s", ecount++, strerror(errno));
|
|
+ CMD_SYSERROR("%d: Read message failed", ecount++);
|
|
}
|
|
continue;
|
|
}
|
|
@@ -270,7 +270,7 @@ void main_loop()
|
|
|
|
rev_buf[len] = '\0';
|
|
if (g_save_log_op(rev_buf, (size_t)len) < 0) {
|
|
- COMMAND_ERROR("write message failed: %s", strerror(errno));
|
|
+ CMD_SYSERROR("write message failed");
|
|
}
|
|
}
|
|
}
|
|
@@ -289,14 +289,14 @@ static int log_file_open()
|
|
}
|
|
fd = util_open(g_log_file, O_CREAT | O_WRONLY | O_APPEND, g_log_mode);
|
|
if (fd == -1) {
|
|
- COMMAND_ERROR("Open %s failed: %s", g_log_file, strerror(errno));
|
|
+ CMD_SYSERROR("Open %s failed", g_log_file);
|
|
ret = -1;
|
|
goto out;
|
|
}
|
|
|
|
/* change log file mode to config, if log file exist and with different mode */
|
|
if (fchmod(fd, g_log_mode) != 0) {
|
|
- COMMAND_ERROR("Change mode of log file: %s failed: %s", g_log_file, strerror(errno));
|
|
+ CMD_SYSERROR("Change mode of log file: %s failed", g_log_file);
|
|
close(fd);
|
|
ret = -1;
|
|
goto out;
|
|
diff --git a/src/utils/console/console.c b/src/utils/console/console.c
|
|
index 3ef88564..568832e8 100644
|
|
--- a/src/utils/console/console.c
|
|
+++ b/src/utils/console/console.c
|
|
@@ -187,7 +187,7 @@ int console_fifo_name(const char *rundir, const char *subpath, const char *stdfl
|
|
if (do_mkdirp) {
|
|
ret = util_mkdir_p(fifo_path, CONSOLE_FIFO_DIRECTORY_MODE);
|
|
if (ret < 0) {
|
|
- COMMAND_ERROR("Unable to create console fifo directory %s: %s.", fifo_path, strerror(errno));
|
|
+ CMD_SYSERROR("Unable to create console fifo directory %s.", fifo_path);
|
|
goto out;
|
|
}
|
|
}
|
|
--
|
|
2.40.1
|
|
|