mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 19:10:11 +01:00
import fix
This commit is contained in:
parent
1d544390d3
commit
aefef17404
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#define VERSION "1.2.0-master"
|
#define VERSION "1.2.0-master"
|
||||||
|
|
||||||
#define BUILD 936
|
#define BUILD 937
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
|
18
src/import.c
18
src/import.c
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
|
|
||||||
int import_message(char *filename, struct session_data *sdata, struct __data *data, struct __config *cfg){
|
int import_message(char *filename, struct session_data *sdata, struct __data *data, struct __config *cfg){
|
||||||
int rc=ERR, fd;
|
int rc=ERR;
|
||||||
char *rule;
|
char *rule;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct parser_state state;
|
struct parser_state state;
|
||||||
@ -57,21 +57,19 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(filename, O_RDONLY);
|
|
||||||
if(fd == -1){
|
|
||||||
printf("cannot open %s\n", filename);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
snprintf(sdata->filename, SMALLBUFSIZE-1, "%s", filename);
|
snprintf(sdata->filename, SMALLBUFSIZE-1, "%s", filename);
|
||||||
|
|
||||||
sdata->tot_len = st.st_size;
|
sdata->tot_len = st.st_size;
|
||||||
|
|
||||||
data->import->total_size += st.st_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(sdata->tot_len < 30){
|
||||||
|
printf("%s is too short: %d bytes\n", sdata->filename, sdata->tot_len);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
data->import->total_size += sdata->tot_len;
|
||||||
|
|
||||||
|
|
||||||
sdata->delivered = 0;
|
sdata->delivered = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user