From 16bfb6e4a4deb5164f8644de3b76129e428653c7 Mon Sep 17 00:00:00 2001 From: wujing Date: Mon, 17 Jan 2022 11:24:05 +0800 Subject: [PATCH 08/16] fix cmd/isulad-shim module encoding problem Signed-off-by: wujing --- src/cmd/isulad-shim/common.c | 2 -- src/cmd/isulad-shim/common.h | 17 ++++++++--------- src/cmd/isulad-shim/process.c | 4 +--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/cmd/isulad-shim/common.c b/src/cmd/isulad-shim/common.c index 324d72a1..20e0963c 100644 --- a/src/cmd/isulad-shim/common.c +++ b/src/cmd/isulad-shim/common.c @@ -236,8 +236,6 @@ void write_message(int fd, const char *level, const char *fmt, ...) if (nwrite != strlen(msg)) { return; } - - return; } /* note: This function can only read small text file. */ diff --git a/src/cmd/isulad-shim/common.h b/src/cmd/isulad-shim/common.h index 8c6ea7ba..d06c5256 100644 --- a/src/cmd/isulad-shim/common.h +++ b/src/cmd/isulad-shim/common.h @@ -26,19 +26,19 @@ extern "C" { // error code #define SHIM_ERR_BASE (-10000) -#define SHIM_SYS_ERR(err) (SHIM_ERR_BASE-err) -#define SHIM_OK 0 -#define SHIM_ERR -1 -#define SHIM_ERR_WAIT -2 -#define SHIM_ERR_NOT_REQUIRED -3 +#define SHIM_SYS_ERR(err) (SHIM_ERR_BASE - err) +#define SHIM_OK 0 +#define SHIM_ERR (-1) +#define SHIM_ERR_WAIT (-2) +#define SHIM_ERR_NOT_REQUIRED (-3) #define INFO_MSG "info" #define WARN_MSG "warn" #define ERR_MSG "error" -#define DEFAULT_TIMEOUT 120 // sec -#define CONTAINER_ID_LEN 64 -#define MAX_RT_NAME_LEN 64 +#define DEFAULT_TIMEOUT 120 // sec +#define CONTAINER_ID_LEN 64 +#define MAX_RT_NAME_LEN 64 #define MAX_CONSOLE_SOCK_LEN 32 #define MAX_RUNTIME_ARGS 20 @@ -73,4 +73,3 @@ int open_no_inherit(const char *path, int flag, mode_t mode); #endif #endif - diff --git a/src/cmd/isulad-shim/process.c b/src/cmd/isulad-shim/process.c index b3014d7a..21b2523a 100644 --- a/src/cmd/isulad-shim/process.c +++ b/src/cmd/isulad-shim/process.c @@ -351,8 +351,6 @@ static void sem_post_inotify_io_copy(int fd, uint32_t event, void *data) thd->shutdown = true; (void)sem_post(&thd->sem_thd); } - - return; } static int create_io_copy_thread(process_t *p, int std_id) @@ -1029,7 +1027,7 @@ static void process_delete(process_t *p) int i = 0; int j; char log_path[PATH_MAX] = { 0 }; - char *cwd; + char *cwd = NULL; cwd = getcwd(NULL, 0); if (cwd == NULL) { -- 2.20.1