From: Jean-Marc Pigeon (Delson) Date: Tue, 3 Jun 2025 12:35:38 +0000 (-0400) Subject: Using execvp instead of execl to start "sender" X-Git-Tag: tag-0.8~73 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=446228ed0439baa40e3821473b10b876e875cc85;p=jmp%2Fmailleur Using execvp instead of execl to start "sender" --- diff --git a/Makefile b/Makefile index f2273e5..0672a92 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,6 @@ sorter : clean debug data-$@/* \ $(TESTDIR)/var/spool/$(APPNAME)/queue @ bin/sorter \ - -f \ -d 2 \ -c ./conf/mailleur.conf.dvl \ -r $(TESTDIR) diff --git a/lib/geseml.c b/lib/geseml.c index 29f4a26..b892c57 100644 --- a/lib/geseml.c +++ b/lib/geseml.c @@ -582,27 +582,32 @@ switch (fork()) { break; case 0 : //the forked process int exitval; - char *xx; - char *rootpath; char *execpath; + char *argv[10]; char buffer[300]; exitval=0; - rootpath=(char *)0; - xx=(char *)0; - if (rootdir!=(char *)0) { - xx="-r"; - rootpath=rootdir; - } + (void) memset(argv,'\000',sizeof(argv)); (void) snprintf(buffer,sizeof(buffer),"%s%s",SBINDIR,SENDER); execpath=rou_apppath(buffer); (void) snprintf(buffer,sizeof(buffer),"%s.%s",todo,EXTODO); - (void) rou_alert(0,"%s JMPDBG starting sender=<%s> testing=<%s> todo= <%s>",OPEP,execpath,rootpath,buffer); - if (execl(execpath,"Bigre","-c",config,buffer,xx,rootpath,(char *)0)<0) { + argv[0]=SENDER; + argv[1]="-c"; + argv[2]=config; + argv[3]=buffer; + if (rootdir!=(char *)0) { + argv[3]="-r"; + argv[4]=rootdir; + argv[5]=buffer; + } + (void) rou_alert(0,"%s JMPDBG starting sender=<%s> todo= <%s>", + OPEP,execpath,buffer); + if (execv(execpath,argv)<0) { (void) rou_alert(0,"%s Unable to exec process=<%s> (error=<%s> Bug?)", OPEP,execpath,strerror(errno)); exitval=-1; } + (void) rou_freestr(execpath); (void) exit(exitval); break; default : //the forking process itself