提交 a1636c9d 编写于 作者: S sun_fan

init: fix test fail

Signed-off-by: Nsun_fan <sun_fan1@hoperun.com>
上级 544c3a1c
...@@ -515,9 +515,10 @@ static void DoMkDir(const char *cmdContent, int maxArg) ...@@ -515,9 +515,10 @@ static void DoMkDir(const char *cmdContent, int maxArg)
FreeCmd(ctx); FreeCmd(ctx);
return; return;
} }
int rc = -1;
do { do {
int index = 0; int index = 0;
int rc = mkdir(ctx->argv[index], DEFAULT_DIR_MODE); rc = mkdir(ctx->argv[index], DEFAULT_DIR_MODE);
if (rc < 0) { if (rc < 0) {
if (errno == EEXIST) { if (errno == EEXIST) {
INIT_LOGE("Path \" %s \" already exist", ctx->argv[0]); INIT_LOGE("Path \" %s \" already exist", ctx->argv[0]);
...@@ -539,14 +540,14 @@ static void DoMkDir(const char *cmdContent, int maxArg) ...@@ -539,14 +540,14 @@ static void DoMkDir(const char *cmdContent, int maxArg)
rc = -1; rc = -1;
} }
} }
if (rc < 0) {
INIT_LOGE("Run command mkdir failed, unlink path");
if (unlink(ctx->argv[0]) < 0) {
INIT_LOGE("Failed unlink %s errno %d ", ctx->argv[0], errno);
}
}
} while (0); } while (0);
if (rc < 0) {
INIT_LOGE("Run command mkdir failed, rmdir path");
if (rmdir(ctx->argv[0]) < 0) {
INIT_LOGE("Failed rmdir %s errno %d ", ctx->argv[0], errno);
}
}
FreeCmd(ctx); FreeCmd(ctx);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册