mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 07:30:12 +01:00
rename path fix
Change-Id: Ib46c6e869fb0ce31ff90f3bc33f60ef2bfcbaddb Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
parent
77ef1d9cce
commit
c0308ac70b
14
src/import.c
14
src/import.c
@ -20,7 +20,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;
|
int rc=ERR;
|
||||||
char *rule, newpath[SMALLBUFSIZE];
|
char *p, *rule, newpath[SMALLBUFSIZE];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct parser_state state;
|
struct parser_state state;
|
||||||
struct counters counters;
|
struct counters counters;
|
||||||
@ -127,8 +127,16 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(rc != OK && data->import->failed_folder){
|
if(rc != OK && data->import->failed_folder){
|
||||||
snprintf(newpath, sizeof(newpath)-2, "%s/%s", data->import->failed_folder, filename);
|
p = strrchr(filename, '/');
|
||||||
rename(filename, newpath);
|
if(p)
|
||||||
|
p++;
|
||||||
|
else
|
||||||
|
p = filename;
|
||||||
|
|
||||||
|
snprintf(newpath, sizeof(newpath)-2, "%s/%s", data->import->failed_folder, p);
|
||||||
|
|
||||||
|
if(rename(filename, newpath))
|
||||||
|
printf("cannot move %s to %s\n", filename, newpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
Reference in New Issue
Block a user