未验证 提交 9aa505f7 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

Hotfix/sangshuduo/td 3197 taosdemo coverity scan for master (#7510)

* [TD-3197]<fix>: taosdemo and taosdump coverity scan issues.

* exit if read sample file failed.

* fix converity scan issue.

* fix coverity scan issue.

* fix coverity scan memory leak.

* fix resource leak reported by coverity scan.

* fix taosdemo coverity scan issue.

* fix tcsetattr and getchar return value determination bug.
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 ffcb8f6a
......@@ -177,7 +177,9 @@ static void parse_args(
fprintf(stderr, "password reading error\n");
}
taosSetConsoleEcho(true);
getchar();
if (EOF == getchar()) {
fprintf(stderr, "getchar() return EOF\n");
}
} else {
tstrncpy(g_password, (char *)(argv[i] + 2), SHELL_MAX_PASSWORD_LEN);
strcpy(argv[i], "-p");
......
......@@ -63,12 +63,12 @@ int taosSetConsoleEcho(bool on)
}
if (on)
term.c_lflag|=ECHOFLAGS;
term.c_lflag |= ECHOFLAGS;
else
term.c_lflag &=~ECHOFLAGS;
term.c_lflag &= ~ECHOFLAGS;
err = tcsetattr(STDIN_FILENO,TCSAFLUSH,&term);
if (err == -1 && err == EINTR) {
err = tcsetattr(STDIN_FILENO, TCSAFLUSH, &term);
if (err == -1 || err == EINTR) {
perror("Cannot set the attribution of the terminal");
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册