mirror of
https://github.com/schoebel/mars
synced 2024-12-18 04:34:48 +00:00
log: tighten start_magic
This commit is contained in:
parent
15009b1395
commit
1e3df0f96c
@ -869,23 +869,10 @@ int log_scan(void *buf,
|
||||
|
||||
DATA_GET(buf, offset, start_magic);
|
||||
if (unlikely(start_magic != START_MAGIC)) {
|
||||
/* Skip any zeros without notice.
|
||||
* This may be used for future extensions, like
|
||||
* padding at certain places of logfiles.
|
||||
*/
|
||||
if (start_magic != 0) {
|
||||
dirty = true;
|
||||
classify_bad_magic(start_magic,
|
||||
&start_byte_code,
|
||||
mars_error_code);
|
||||
if (start_byte_code && !*byte_code) {
|
||||
*byte_code = start_byte_code;
|
||||
MARS_WRN(SCAN_TXT "found repeated byte pattern 0x%02x",
|
||||
SCAN_PAR,
|
||||
start_byte_code);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
MARS_ERR(SCAN_TXT "bad start magic 0x%llx\n",
|
||||
SCAN_PAR, start_magic);
|
||||
RECORD_ERR(-MARS_ERR_SCAN_MAGIC);
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
restlen = len - i;
|
||||
|
@ -55,6 +55,7 @@
|
||||
#define MARS_ERR_SCAN_SEQ_FW 10010 /* Illegal record sequence skip forward */
|
||||
#define MARS_ERR_SCAN_SEQ_BW 10011 /* Record sequence skip backwards */
|
||||
#define MARS_ERR_SCAN_SIZE 10012 /* Internal size mismatch */
|
||||
#define MARS_ERR_SCAN_MAGIC 10013 /* Unrecognized record */
|
||||
|
||||
#define MARS_ERR_MAGIC_BAD 10020 /* Bad magic */
|
||||
#define MARS_ERR_MAGIC_REPEATED 10021 /* Bad magic has repeated pattern */
|
||||
|
Loading…
Reference in New Issue
Block a user