Skip to content

Commit 65caaab

Browse files
committed
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.
1 parent 0b892c9 commit 65caaab

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

avro/maxavro_file.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
#include "maxavro.h"
15+
#include "skygw_utils.h"
1516
#include <errno.h>
1617
#include <string.h>
1718
#include <log_manager.h>
@@ -49,11 +50,12 @@ bool maxavro_verify_block(MAXAVRO_FILE *file)
4950
int rc = fread(sync, 1, SYNC_MARKER_SIZE, file->file);
5051
if (rc != SYNC_MARKER_SIZE)
5152
{
52-
if (rc == -1)
53+
if (ferror(file->file))
5354
{
54-
MXS_ERROR("Failed to read file: %d %s", errno, strerror(errno));
55+
char err[STRERROR_BUFLEN];
56+
MXS_ERROR("Failed to read file: %d %s", errno, strerror_r(errno, err, sizeof(err)));
5557
}
56-
else
58+
else if (rc > 0 || !feof(file->file))
5759
{
5860
MXS_ERROR("Short read when reading sync marker. Read %d bytes instead of %d",
5961
rc, SYNC_MARKER_SIZE);

0 commit comments

Comments
 (0)