src: dir import fix #3

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2017-10-28 22:33:47 +02:00
parent 7b0f93edf6
commit 052a93fc3d

View File

@ -27,7 +27,7 @@ int import_from_maildir(struct session_data *sdata, struct data *data, char *dir
struct dirent *de; struct dirent *de;
int rc=ERR, ret=OK, i=0; int rc=ERR, ret=OK, i=0;
int folder; int folder;
char *p; char *p, subdir[SMALLBUFSIZE];
struct stat st; struct stat st;
dir = opendir(directory); dir = opendir(directory);
@ -45,7 +45,8 @@ int import_from_maildir(struct session_data *sdata, struct data *data, char *dir
if(stat(data->import->filename, &st) == 0){ if(stat(data->import->filename, &st) == 0){
if(S_ISDIR(st.st_mode)){ if(S_ISDIR(st.st_mode)){
folder = data->folder; folder = data->folder;
rc = import_from_maildir(sdata, data, data->import->filename, cfg); snprintf(subdir, sizeof(subdir)-1, "%s", data->import->filename);
rc = import_from_maildir(sdata, data, subdir, cfg);
data->folder = folder; data->folder = folder;
if(rc == ERR) ret = ERR; if(rc == ERR) ret = ERR;
} }