Skip to content
Snippets Groups Projects
Commit 8776b5e9 authored by rswindell's avatar rswindell
Browse files

Attempt to addres Bill McGarrity's reported error:

2016-01-20 06:06:39 ERROR line 1836 renaming c:\fd\outbound\20060640.pk_ to
c:\fd\outbound\20060640.pkt
I think this is because the file 200606040.pkt already existed when the
.pk_ temp file was created and thus the rename will fail (can't rename over
an existing file) and then the packet is sent to the wrong link.
When generating a packet name, keep incrementing until both the .pkt and
.pk_ variants do not already exist. This should fix this scenario.
parent e33a4288
No related branches found
No related tags found
No related merge requests found
......@@ -2827,6 +2827,7 @@ void seektonull(FILE *stream)
char *pktname(BOOL temp)
{
static char str[128];
static char tmp[128];
int i;
time_t now;
struct tm *tm;
......@@ -2835,10 +2836,12 @@ char *pktname(BOOL temp)
for(i=0;i>=0;i++) {
now++;
tm=localtime(&now);
sprintf(str,"%s%02u%02u%02u%02u.%s",cfg.outbound,tm->tm_mday,tm->tm_hour
,tm->tm_min,tm->tm_sec,temp ? "pk_" : "pkt");
if(!fexist(str)) /* Add 1 second if name exists */
return(str);
sprintf(str,"%s%02u%02u%02u%02u.pkt",cfg.outbound,tm->tm_mday,tm->tm_hour
,tm->tm_min,tm->tm_sec);
sprintf(tmp,"%s%02u%02u%02u%02u.pk_",cfg.outbound,tm->tm_mday,tm->tm_hour
,tm->tm_min,tm->tm_sec);
if(!fexist(str) && !fexist(tmp)) /* Add 1 second if name exists */
return(temp ? tmp : str);
}
return(NULL); /* This should never happen */
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment