From: Jean-Marc Pigeon (Delson) Date: Fri, 13 Jun 2025 09:00:15 +0000 (-0400) Subject: procedure eml_countqfile is working fine X-Git-Tag: tag-0.8~14 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=188bfeb8962c8e273705d71640e275e2eaba0a8b;p=jmp%2Fmailleur procedure eml_countqfile is working fine --- diff --git a/Makefile b/Makefile index 28335a9..67ade01 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ TESTITER= 1 #To test sorter dosorter: @ bin/sorter \ + -f \ -d 2 \ -c ./conf/mailleur.conf.dvl \ -r $(TESTDIR) diff --git a/lib/geseml.c b/lib/geseml.c index 4824794..3037aa5 100644 --- a/lib/geseml.c +++ b/lib/geseml.c @@ -489,55 +489,33 @@ PUBLIC void eml_doneqfile(TRATYP **list) { #define OPEP "geseml.c:eml_doneqfile," -SIDTYP **sids; TRATYP **next; -sids=(SIDTYP **)0; next=(TRATYP **)0; if (list!=(TRATYP **)0) { TRATYP **ptr; ptr=list; while (*ptr!=(TRATYP *)0) { - SIDTYP *found; - - found=eml_addsid(&sids,(*ptr)->sessid); - switch ((*ptr)->code) { - case 'C' : //completed - break; - default : - next=(TRATYP **)rou_addlist((void **)next,(void *)eml_duptra(*ptr)); - found->count++; - break; - } - ptr++; - } - } -if (sids!=(SIDTYP **)0) { - SIDTYP **ptr; - - ptr=sids; - while (*ptr!=(SIDTYP *)0) { - if ((*ptr)->count==0) { + if (((*ptr)->code=='C')&&(eml_countqfile((*ptr)->sessid,-1)==0)) { (void) rou_alert(0,"%s JMPDBG need to remove <%s>",OPEP,(*ptr)->sessid); (void) eml_deleteqfile((*ptr)->sessid); } + else + next=(TRATYP **)rou_addlist((void **)next,(void *)eml_duptra(*ptr)); ptr++; } - sids=eml_freesid(sids); } if (next!=(TRATYP **)0) { FILE *qfile; - uuid_t id; + time_t current; char qname[150]; - char struuid[40]; int phase; _Bool proceed; qfile=(FILE *)0; - (void) uuid_generate(id); - (void) uuid_unparse(id,struuid); - (void) snprintf(qname,sizeof(qname),"%s-%s-%04d",struuid,"redo",0); + (void) time(¤t); + (void) snprintf(qname,sizeof(qname),"%08ld-%08d-%04d",current,getpid(),0); phase=0; proceed=true; while (proceed==true) { diff --git a/lib/unieml.c b/lib/unieml.c index 3b19f87..fd66b8c 100644 --- a/lib/unieml.c +++ b/lib/unieml.c @@ -703,8 +703,8 @@ while (proceed==true) { case 1 : //opening count file char name[300]; - (void) snprintf(name,sizeof(name),"%s.%s/%s",filename,qfilename,EXTCNT); - if ((fcount=fopen(name,"rw"))==(FILE *)0) { + (void) snprintf(name,sizeof(name),"%s/%s.%s",filename,qfilename,EXTCNT); + if ((fcount=fopen(name,"r+"))==(FILE *)0) { (void) rou_alert(0,"%s unable to open count file <%s> (error=<%s>)", OPEP,name,strerror(errno)); phase=999; //Big trouble