@ -732,9 +732,10 @@ bool CheckIfEanbedSaveSlots()
|
||||
securec_check_c(ret, "", "");
|
||||
if ((strcmp(optvalue, "1") == 0) || (strcmp(optvalue, "true") == 0) || (strcmp(optvalue, "on") == 0)) {
|
||||
pg_log(PG_PROGRESS, _("Enable saving confirmed_lsn in target %s\n"), config_file);
|
||||
freefile(optlines);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
freefile(optlines);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -303,6 +303,11 @@ static void print_top_stack(int fd, uintptr_t sp)
|
||||
{
|
||||
output(fd, "====== Top of stack ======\nsp = 0x016%lx\n", sp);
|
||||
|
||||
if (sp == 0) {
|
||||
output(fd, "Invalid stack pointer\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 *start = (uint64 *)sp;
|
||||
uint64 *end = start + 64;
|
||||
|
||||
|
||||
@ -758,7 +758,6 @@ int gs_thread_create_ex(gs_thread_t* th, void* (*taskRoutine)(void*), int argc,
|
||||
int error_code = 0;
|
||||
bool needFree = false;
|
||||
|
||||
pArg = (ThreadArg*)argv;
|
||||
if (argv == NULL) {
|
||||
/*
|
||||
* just special thread which not exit at gaussdb runtime, so the pArg no need to free. for example: signal
|
||||
@ -778,6 +777,8 @@ int gs_thread_create_ex(gs_thread_t* th, void* (*taskRoutine)(void*), int argc,
|
||||
*/
|
||||
pArg->next = (struct ThreadArg*)INVALID_NEXT_ADDR;
|
||||
needFree = true;
|
||||
} else {
|
||||
pArg = (ThreadArg*)argv;
|
||||
}
|
||||
|
||||
pArg->m_taskRoutine = taskRoutine;
|
||||
|
||||
@ -146,6 +146,7 @@ static CmkemErrCode create_file_and_write(const char *real_path, const unsigned
|
||||
int fd = 0;
|
||||
char head[KEY_FILE_HEADER_LEN] = {0};
|
||||
errno_t rc = 0;
|
||||
ssize_t written = 0;
|
||||
|
||||
fd = open(real_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
||||
if (fd == -1) {
|
||||
@ -156,12 +157,22 @@ static CmkemErrCode create_file_and_write(const char *real_path, const unsigned
|
||||
if (is_write_header) {
|
||||
rc = sprintf_s(head, sizeof(head), "%lu", content_len);
|
||||
securec_check_ss_c(rc, "", "");
|
||||
write(fd, head, sizeof(head));
|
||||
written = write(fd, head, sizeof(head));
|
||||
if (written != sizeof(head)) {
|
||||
cmkem_errmsg("failed to write header to file '%s'.\n", real_path);
|
||||
(void)close(fd);
|
||||
return CMKEM_WRITE_FILE_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
write(fd, content, content_len);
|
||||
close(fd);
|
||||
written = write(fd, content, content_len);
|
||||
if (written != content_len) {
|
||||
cmkem_errmsg("failed to write content to file '%s'.\n", real_path);
|
||||
(void)close(fd);
|
||||
return CMKEM_WRITE_FILE_ERR;
|
||||
}
|
||||
|
||||
(void)close(fd);
|
||||
return CMKEM_SUCCEED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user