MCPcopy Create free account
hub / github.com/MariaDB/server / update_file_path

Function update_file_path

plugin/server_audit/server_audit.cc:2286–2340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2284
2285
2286static void update_file_path(MYSQL_THD thd, st_mysql_sys_var *, void *,
2287 const void *save)
2288{
2289 char *new_name= *static_cast<char*const*>(save);
2290 if (!new_name)
2291 new_name= empty_str;
2292 else if (strlen(new_name) + 4 > FN_REFLEN)
2293 {
2294 error_header();
2295 fprintf(stderr,
2296 "server_audit_file_path can't exceed %d characters.\n",
2297 FN_REFLEN - 4);
2298 fprintf(stderr, "Log filename remains unchanged '%s'.\n", file_path);
2299 CLIENT_ERROR(1, "server_audit_file_path can't exceed %d characters.",
2300 MYF(ME_WARNING), FN_REFLEN - 4);
2301 return;
2302 }
2303
2304 lock_operations.wr_lock();
2305 internal_stop_logging++;
2306 error_header();
2307 fprintf(stderr, "Log file name was changed to '%s'.\n", new_name);
2308
2309 if (logging)
2310 log_current_query(thd);
2311
2312 if (logging && output_type == OUTPUT_FILE)
2313 {
2314 char *sav_path= file_path;
2315
2316 file_path= new_name;
2317 stop_logging();
2318 if (start_logging())
2319 {
2320 file_path= sav_path;
2321 error_header();
2322 fprintf(stderr, "Reverting log filename back to '%s'.\n", file_path);
2323 logging= (start_logging() == 0);
2324 if (!logging)
2325 {
2326 error_header();
2327 fprintf(stderr, "Logging was disabled..\n");
2328 CLIENT_ERROR(1, "Logging was disabled.", MYF(ME_WARNING));
2329 }
2330 goto exit_func;
2331 }
2332 }
2333
2334 strncpy(path_buffer, new_name, sizeof(path_buffer)-1);
2335 path_buffer[sizeof(path_buffer)-1]= 0;
2336 file_path= path_buffer;
2337exit_func:
2338 internal_stop_logging--;
2339 lock_operations.wr_unlock();
2340}
2341
2342
2343static int check_timestamp_format(MYSQL_THD thd, st_mysql_sys_var *,

Callers

nothing calls this directly

Calls 6

error_headerFunction · 0.85
log_current_queryFunction · 0.85
stop_loggingFunction · 0.85
start_loggingFunction · 0.85
wr_lockMethod · 0.45
wr_unlockMethod · 0.45

Tested by

no test coverage detected