Fixed formatting and added more error checks

Added log messages when ftruncate fails and cleaned up formatting.
This commit is contained in:
Markus Makela 2016-02-16 11:04:49 +02:00
parent cd2af6ffef
commit 63ce9fe6bc
2 changed files with 9 additions and 3 deletions

View File

@ -338,8 +338,14 @@ int n;
router->service->name, router->last_written,
router->binlog_name,
strerror_r(errno, err_msg, sizeof(err_msg)));
/* Remove any partual event that was written */
ftruncate(router->binlog_fd, router->last_written);
/* Remove any partial event that was written */
if (ftruncate(router->binlog_fd, router->last_written))
{
MXS_ERROR("%s: Failed to truncate binlog record at %lu of %s, %s. ",
router->service->name, router->last_written,
router->binlog_name,
strerror_r(errno, err_msg, sizeof(err_msg)));
}
return 0;
}
spinlock_acquire(&router->binlog_lock);

View File

@ -2388,7 +2388,7 @@ int n;
strerror_r(errno, err_msg, sizeof(err_msg)));
/* Remove any partial event that was written */
if(ftruncate(router->binlog_fd, router->last_written))
if (ftruncate(router->binlog_fd, router->last_written))
{
MXS_ERROR("%s: Failed to truncate binlog record at %lu of %s, %s. ",
router->service->name, router->last_written,