Fix maxavro block verification errors
An error was logged when the end of file was reached. The error should only be logged when a partial sync marker is read and the end of file has not been reached.
This commit is contained in:
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "maxavro.h"
|
#include "maxavro.h"
|
||||||
|
#include "skygw_utils.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <log_manager.h>
|
#include <log_manager.h>
|
||||||
@ -49,11 +50,12 @@ bool maxavro_verify_block(MAXAVRO_FILE *file)
|
|||||||
int rc = fread(sync, 1, SYNC_MARKER_SIZE, file->file);
|
int rc = fread(sync, 1, SYNC_MARKER_SIZE, file->file);
|
||||||
if (rc != SYNC_MARKER_SIZE)
|
if (rc != SYNC_MARKER_SIZE)
|
||||||
{
|
{
|
||||||
if (rc == -1)
|
if (ferror(file->file))
|
||||||
{
|
{
|
||||||
MXS_ERROR("Failed to read file: %d %s", errno, strerror(errno));
|
char err[STRERROR_BUFLEN];
|
||||||
|
MXS_ERROR("Failed to read file: %d %s", errno, strerror_r(errno, err, sizeof(err)));
|
||||||
}
|
}
|
||||||
else
|
else if (rc > 0 || !feof(file->file))
|
||||||
{
|
{
|
||||||
MXS_ERROR("Short read when reading sync marker. Read %d bytes instead of %d",
|
MXS_ERROR("Short read when reading sync marker. Read %d bytes instead of %d",
|
||||||
rc, SYNC_MARKER_SIZE);
|
rc, SYNC_MARKER_SIZE);
|
||||||
|
|||||||
Reference in New Issue
Block a user