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: Shuduo Sang <sdsang@taosdata.com>
This commit is contained in:
parent
ffcb8f6a4a
commit
9aa505f7df
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue