use fc_safe_strcpy and fc_combine_two_string
parent
03f64998ce
commit
7b3f6d620a
|
|
@ -357,8 +357,7 @@ static void *binlog_writer_func(void *arg)
|
||||||
#ifdef OS_LINUX
|
#ifdef OS_LINUX
|
||||||
{
|
{
|
||||||
char thread_name[64];
|
char thread_name[64];
|
||||||
snprintf(thread_name, sizeof(thread_name),
|
fc_combine_two_string(thread->name, "writer", '-', thread_name);
|
||||||
"%s-writer", thread->name);
|
|
||||||
prctl(PR_SET_NAME, thread_name);
|
prctl(PR_SET_NAME, thread_name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -497,7 +496,7 @@ int sf_binlog_writer_init_thread_ex(SFBinlogWriterThread *thread,
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
struct fast_mblock_object_callbacks callbacks;
|
struct fast_mblock_object_callbacks callbacks;
|
||||||
|
|
||||||
snprintf(thread->name, sizeof(thread->name), "%s", name);
|
fc_safe_strcpy(thread->name, name);
|
||||||
thread->order_mode = order_mode;
|
thread->order_mode = order_mode;
|
||||||
thread->use_fixed_buffer_size = use_fixed_buffer_size;
|
thread->use_fixed_buffer_size = use_fixed_buffer_size;
|
||||||
thread->passive_write = passive_write;
|
thread->passive_write = passive_write;
|
||||||
|
|
|
||||||
|
|
@ -220,9 +220,7 @@ int sf_load_slow_log_config_ex(IniFullContext *ini_ctx, LogContext *log_ctx,
|
||||||
if (filename_prefix == NULL || *filename_prefix == '\0') {
|
if (filename_prefix == NULL || *filename_prefix == '\0') {
|
||||||
strcpy(slow_log_cfg->filename_prefix, "slow");
|
strcpy(slow_log_cfg->filename_prefix, "slow");
|
||||||
} else {
|
} else {
|
||||||
snprintf(slow_log_cfg->filename_prefix,
|
fc_safe_strcpy(slow_log_cfg->filename_prefix, filename_prefix);
|
||||||
sizeof(slow_log_cfg->filename_prefix),
|
|
||||||
"%s", filename_prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -331,9 +329,7 @@ int sf_load_global_config_ex(const char *log_filename_prefix,
|
||||||
*g_sf_global_vars.run_by.group = '\0';
|
*g_sf_global_vars.run_by.group = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snprintf(g_sf_global_vars.run_by.group,
|
fc_safe_strcpy(g_sf_global_vars.run_by.group, pRunByGroup);
|
||||||
sizeof(g_sf_global_vars.run_by.group),
|
|
||||||
"%s", pRunByGroup);
|
|
||||||
}
|
}
|
||||||
if (*(g_sf_global_vars.run_by.group) == '\0') {
|
if (*(g_sf_global_vars.run_by.group) == '\0') {
|
||||||
g_sf_global_vars.run_by.gid = getegid();
|
g_sf_global_vars.run_by.gid = getegid();
|
||||||
|
|
@ -358,9 +354,7 @@ int sf_load_global_config_ex(const char *log_filename_prefix,
|
||||||
*g_sf_global_vars.run_by.user = '\0';
|
*g_sf_global_vars.run_by.user = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snprintf(g_sf_global_vars.run_by.user,
|
fc_safe_strcpy(g_sf_global_vars.run_by.user, pRunByUser);
|
||||||
sizeof(g_sf_global_vars.run_by.user),
|
|
||||||
"%s", pRunByUser);
|
|
||||||
}
|
}
|
||||||
if (*(g_sf_global_vars.run_by.user) == '\0') {
|
if (*(g_sf_global_vars.run_by.user) == '\0') {
|
||||||
g_sf_global_vars.run_by.uid = geteuid();
|
g_sf_global_vars.run_by.uid = geteuid();
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,7 @@ static void *binlog_writer_func(void *arg)
|
||||||
#ifdef OS_LINUX
|
#ifdef OS_LINUX
|
||||||
{
|
{
|
||||||
char thread_name[64];
|
char thread_name[64];
|
||||||
snprintf(thread_name, sizeof(thread_name),
|
fc_combine_two_string(thread->name, "writer", '-', thread_name);
|
||||||
"%s-writer", thread->name);
|
|
||||||
prctl(PR_SET_NAME, thread_name);
|
prctl(PR_SET_NAME, thread_name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -203,7 +202,7 @@ static int sf_ordered_writer_init_thread(SFOrderedWriterContext *context,
|
||||||
|
|
||||||
thread = &context->thread;
|
thread = &context->thread;
|
||||||
writer = &context->writer;
|
writer = &context->writer;
|
||||||
snprintf(thread->name, sizeof(thread->name), "%s", name);
|
fc_safe_strcpy(thread->name, name);
|
||||||
writer->fw.cfg.max_record_size = max_record_size;
|
writer->fw.cfg.max_record_size = max_record_size;
|
||||||
writer->thread = thread;
|
writer->thread = thread;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue