Unified2File.c (snort-2.9.16.1) | : | Unified2File.c (snort-2.9.17) | ||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
#ifndef MAX_U2_MESSAGE | #ifndef MAX_U2_MESSAGE | |||
#define MAX_U2_MESSAGE (16*1024*1024) | #define MAX_U2_MESSAGE (16*1024*1024) | |||
#endif | #endif | |||
#define U2R_EXTENDED_HEADER_BIT 0x80000000 | #define U2R_EXTENDED_HEADER_BIT 0x80000000 | |||
/* Unified2 File API **********************************************************/ | /* Unified2 File API **********************************************************/ | |||
int Unified2File_Open(char *filepath, Unified2File **u2_file) | int Unified2File_Open(char *filepath, Unified2File **u2_file) | |||
{ | { | |||
Unified2File *tmp; | Unified2File *tmp; | |||
char fn[1024]; | ||||
if(!filepath || !u2_file) | if(!filepath || !u2_file) | |||
return SF_EINVAL; | return SF_EINVAL; | |||
if(!(tmp = (Unified2File *)calloc(1, sizeof(Unified2File)))) | if(!(tmp = (Unified2File *)calloc(1, sizeof(Unified2File)))) | |||
{ | { | |||
fprintf(stderr, "Out of memory (wanted %zu bytes)", sizeof(Unified2File) ); | fprintf(stderr, "Out of memory (wanted %zu bytes)", sizeof(Unified2File) ); | |||
return SF_ENOMEM; | return SF_ENOMEM; | |||
} | } | |||
tmp->fd = -1; | tmp->fd = -1; | |||
tmp->read_status = U2FILE_STATUS_HEADER_READY; | tmp->read_status = U2FILE_STATUS_HEADER_READY; | |||
tmp->read_errno = 0; | tmp->read_errno = 0; | |||
tmp->read_offset = 0; | tmp->read_offset = 0; | |||
tmp->u2_record = NULL; | tmp->u2_record = NULL; | |||
if((tmp->fd = open(filepath, O_RDONLY)) == -1) | if((tmp->fd = open(filepath, O_RDONLY)) == -1) | |||
{ | { | |||
fprintf(stderr, "Unable to open file '%s': %s", | fprintf(stderr, "Unable to open file '%s': %s", | |||
fn, strerror(errno)); | filepath, strerror(errno)); | |||
free(tmp); | free(tmp); | |||
return SF_EOPEN; /* XXX better return code */ | return SF_EOPEN; /* XXX better return code */ | |||
} | } | |||
*u2_file = tmp; | *u2_file = tmp; | |||
return SF_SUCCESS; | return SF_SUCCESS; | |||
} | } | |||
int Unified2File_Close(Unified2File *u2_file) | int Unified2File_Close(Unified2File *u2_file) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added |