提交 cf014abd 编写于 作者: F fang

solve some static check questions for shell/src/

上级 84d955e7
......@@ -780,6 +780,7 @@ void source_file(TAOS *con, char *fptr) {
if (wordexp(fptr, &full_path, 0) != 0) {
fprintf(stderr, "ERROR: illegal file name\n");
free(cmd);
return;
}
......@@ -788,6 +789,7 @@ void source_file(TAOS *con, char *fptr) {
if (access(fname, R_OK) == -1) {
fprintf(stderr, "ERROR: file %s is not readable\n", fptr);
wordfree(&full_path);
free(cmd);
return;
}
......@@ -795,6 +797,7 @@ void source_file(TAOS *con, char *fptr) {
if (f == NULL) {
fprintf(stderr, "ERROR: failed to open file %s\n", fname);
wordfree(&full_path);
free(cmd);
return;
}
......
......@@ -277,7 +277,10 @@ void *shellLoopQuery(void *arg) {
pthread_cleanup_push(cleanup_handler, NULL);
char *command = malloc(MAX_COMMAND_SIZE);
if (command == NULL){
tscError("failed to malloc command");
return NULL;
}
while (1) {
// Read command from shell.
......@@ -286,10 +289,8 @@ void *shellLoopQuery(void *arg) {
shellReadCommand(con, command);
reset_terminal_mode();
if (command != NULL) {
// Run the command
shellRunCommand(con, command);
}
// Run the command
shellRunCommand(con, command);
}
pthread_cleanup_pop(1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册