fix the bug that the setLocale function return wrong value to cause both the TDengine and Shell fail to launch.#494 #478
This commit is contained in:
parent
93371c71c9
commit
9c468129d2
|
@ -831,6 +831,12 @@ void tsSetAllDebugFlag() {
|
||||||
pPrint("all debug flag are set to %d", debugFlag);
|
pPrint("all debug flag are set to %d", debugFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In some Linux systems, setLocale(LC_CTYPE, "") may return NULL, in which case the launch of
|
||||||
|
* both the TDengine Server and the Client may be interrupted.
|
||||||
|
*
|
||||||
|
* In case that the setLocale failed to be executed, the right charset needs to be set.
|
||||||
|
*/
|
||||||
void tsSetLocale() {
|
void tsSetLocale() {
|
||||||
char msgLocale[] = "Invalid locale:%s, please set the valid locale in config file";
|
char msgLocale[] = "Invalid locale:%s, please set the valid locale in config file";
|
||||||
char msgCharset[] = "Invalid charset:%s, please set the valid charset in config file";
|
char msgCharset[] = "Invalid charset:%s, please set the valid charset in config file";
|
||||||
|
@ -838,11 +844,10 @@ void tsSetLocale() {
|
||||||
|
|
||||||
char *locale = setlocale(LC_CTYPE, tsLocale);
|
char *locale = setlocale(LC_CTYPE, tsLocale);
|
||||||
|
|
||||||
/* default locale or user specified locale is not valid, abort launch */
|
// default locale or user specified locale is not valid, abort launch
|
||||||
if (locale == NULL) {
|
if (locale == NULL) {
|
||||||
printf(msgLocale, tsLocale);
|
printf(msgLocale, tsLocale);
|
||||||
pPrint(msgLocale, tsLocale);
|
pPrint(msgLocale, tsLocale);
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(tsCharset) == 0) {
|
if (strlen(tsCharset) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue