| 3464 | |
| 3465 | |
| 3466 | File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg) |
| 3467 | { |
| 3468 | File file; |
| 3469 | DBUG_ENTER("open_binlog"); |
| 3470 | |
| 3471 | if ((file= mysql_file_open(key_file_binlog, |
| 3472 | log_file_name, O_RDONLY | O_BINARY | O_SHARE, |
| 3473 | MYF(MY_WME))) < 0) |
| 3474 | { |
| 3475 | sql_print_error("Failed to open log (file '%s', errno %d)", |
| 3476 | log_file_name, my_errno); |
| 3477 | *errmsg = "Could not open log file"; |
| 3478 | goto err; |
| 3479 | } |
| 3480 | if (init_io_cache_ext(log, file, (size_t)binlog_file_cache_size, READ_CACHE, |
| 3481 | 0, 0, MYF(MY_WME|MY_DONT_CHECK_FILESIZE), key_file_binlog_cache)) |
| 3482 | { |
| 3483 | sql_print_error("Failed to create a cache on log (file '%s')", |
| 3484 | log_file_name); |
| 3485 | *errmsg = "Could not open log file"; |
| 3486 | goto err; |
| 3487 | } |
| 3488 | if (check_binlog_magic(log,errmsg)) |
| 3489 | goto err; |
| 3490 | DBUG_RETURN(file); |
| 3491 | |
| 3492 | err: |
| 3493 | if (file >= 0) |
| 3494 | { |
| 3495 | mysql_file_close(file, MYF(0)); |
| 3496 | end_io_cache(log); |
| 3497 | } |
| 3498 | DBUG_RETURN(-1); |
| 3499 | } |
| 3500 | |
| 3501 | #ifdef _WIN32 |
| 3502 | static int eventSource = 0; |
no test coverage detected