!664 emit error message for incorrect GAUSSLOG

Merge pull request !664 from liang/1.1.0_log
This commit is contained in:
opengauss-bot 2021-02-02 11:08:49 +08:00 committed by Gitee
commit 091c5dec87
1 changed files with 7 additions and 1 deletions

View File

@ -1782,7 +1782,9 @@ static void LogCtlCreateLogParentDirectory(void)
{
char* logdir = NULL;
/* create directory for profile log */
/* create directory for profile log.
* if EEXIST == errno, this directory may be created already, don't care this case.
*/
logdir = LogCtlGetLogDirectory(PROFILE_LOG_TAG, false);
if (0 == mkdir(logdir, S_IRWXU) || (EEXIST == errno)) {
/*
@ -1792,6 +1794,10 @@ static void LogCtlCreateLogParentDirectory(void)
* ignore its returned value of this case.
*/
(void)chmod(logdir, S_IRWXU);
} else if (EEXIST != errno) {
ereport(FATAL,
(errmsg(
"could not create log directory \"%s\": %s\n", logdir, gs_strerror(errno))));
}
pfree(logdir);