!24 fix shim static check

Merge pull request !24 from gaohuatao/ght_fix
This commit is contained in:
openeuler-ci-bot 2020-03-19 20:58:28 +08:00 committed by Gitee
commit a6dab654d7
2 changed files with 6 additions and 5 deletions

View File

@ -16,6 +16,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <linux/limits.h>
#include <limits.h> #include <limits.h>
#include "terminal.h" #include "terminal.h"
#include "common.h" #include "common.h"
@ -69,9 +70,13 @@ static int shim_rename_old_log_file(log_terminal *terminal)
static int shim_dump_log_file(log_terminal *terminal) static int shim_dump_log_file(log_terminal *terminal)
{ {
int ret; int ret;
char *file_newname; char *file_newname = NULL;
size_t len_path = strlen(terminal->log_path) + sizeof(".1"); size_t len_path = strlen(terminal->log_path) + sizeof(".1");
if (len_path > PATH_MAX) {
return SHIM_ERR;
}
/* isulad: rotate old log file first */ /* isulad: rotate old log file first */
ret = shim_rename_old_log_file(terminal); ret = shim_rename_old_log_file(terminal);
if (ret != 0) { if (ret != 0) {

View File

@ -24,10 +24,6 @@
extern "C" { extern "C" {
#endif #endif
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
typedef struct { typedef struct {
uint64_t log_maxsize; uint64_t log_maxsize;
char *log_path; char *log_path;