]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Using execvp instead of execl to start "sender"
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 3 Jun 2025 12:35:38 +0000 (08:35 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 3 Jun 2025 12:35:38 +0000 (08:35 -0400)
Makefile
lib/geseml.c

index f2273e5b9907d1f0d99b4f3bebec24e829716e15..0672a92baa00a220915ac1e965532fa836720020 100644 (file)
--- 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) 
index 29f4a260de98b074d0791ffef7215e1167b2e1bc..b892c57ff6fe30a601e499fe87153730c35b0707 100644 (file)
@@ -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