mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:00:12 +01:00
journaling additional fix
This commit is contained in:
parent
55de53bb26
commit
14ef68ed98
@ -13,7 +13,7 @@
|
||||
|
||||
#define VERSION "0.1.21"
|
||||
|
||||
#define BUILD 708
|
||||
#define BUILD 709
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -84,7 +84,7 @@ struct _state parse_message(struct session_data *sdata, int take_into_pieces, st
|
||||
}
|
||||
|
||||
if(take_into_pieces == 1 && state.writebufpos > 0){
|
||||
if(state.ms_journal == 1) remove_trailing_journal_boundary(&writebuffer[0], &state);
|
||||
if(state.ms_journal == 1) remove_trailing_journal_boundary(sdata, &state, &writebuffer[0]);
|
||||
|
||||
len = write(state.mfd, writebuffer, state.writebufpos);
|
||||
memset(writebuffer, 0, sizeof(writebuffer));
|
||||
@ -214,7 +214,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
||||
state->saved_size += len;
|
||||
//n = write(state->mfd, buf, len); // WRITE
|
||||
if(len + state->writebufpos > writebuffersize-1){
|
||||
if(state->ms_journal == 1) remove_trailing_journal_boundary(writebuffer, state);
|
||||
if(state->ms_journal == 1) remove_trailing_journal_boundary(sdata, state, writebuffer);
|
||||
n = write(state->mfd, writebuffer, state->writebufpos); state->writebufpos = 0; memset(writebuffer, 0, writebuffersize);
|
||||
}
|
||||
memcpy(writebuffer+state->writebufpos, buf, len); state->writebufpos += len;
|
||||
|
@ -34,6 +34,6 @@ char *determine_attachment_type(char *filename, char *type);
|
||||
char *get_attachment_extractor_by_filename(char *filename);
|
||||
void parse_reference(struct _state *state, char *s);
|
||||
int base64_decode_attachment_buffer(char *p, int plen, unsigned char *b, int blen);
|
||||
void remove_trailing_journal_boundary(char *writebuffer, struct _state *state);
|
||||
void remove_trailing_journal_boundary(struct session_data *sdata, struct _state *state, char *writebuffer);
|
||||
|
||||
#endif /* _PARSER_H */
|
||||
|
@ -813,16 +813,21 @@ int base64_decode_attachment_buffer(char *p, int plen, unsigned char *b, int ble
|
||||
}
|
||||
|
||||
|
||||
void remove_trailing_journal_boundary(char *writebuffer, struct _state *state){
|
||||
void remove_trailing_journal_boundary(struct session_data *sdata, struct _state *state, char *writebuffer){
|
||||
int len;
|
||||
char *p;
|
||||
|
||||
p = strstr(writebuffer, state->boundaries->s);
|
||||
if(p){
|
||||
state->writebufpos -= strlen(p);
|
||||
len = strlen(p);
|
||||
state->writebufpos -= len;
|
||||
sdata->tot_len -= len;
|
||||
*p = '\0';
|
||||
p = strrchr(writebuffer, '\n');
|
||||
if(p){
|
||||
state->writebufpos -= strlen(p);
|
||||
len = strlen(p);
|
||||
state->writebufpos -= len;
|
||||
sdata->tot_len -= len;
|
||||
*p = '\0';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user