]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Able to start program emlrec from maild
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 10 Jul 2024 23:38:40 +0000 (19:38 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 10 Jul 2024 23:38:40 +0000 (19:38 -0400)
app/maild.c
lib/subrou.c

index e4c4739ecc2828a328da8fd0ae74c6aaeaa40f79..4f46f9f9b19af5971beb15744adbcb0c78b8053d 100644 (file)
@@ -4,9 +4,11 @@
 /*     Main SMTP Daemon                                */
 /*                                                     */
 /********************************************************/
+#include       <errno.h>
 #include       <signal.h>
 #include       <stdlib.h>
 #include       <stdio.h>
+#include       <string.h>
 #include       <unistd.h>
 
 #include       "subrou.h"
 static void task(u_int iteration)
 
 {
+#define OPEP    "maild.c:task"
+char *emlrec;
+char *argv[10];
 pid_t *pidlst;
 int phase;
 _Bool proceed;
 
+emlrec=rou_apppath("/usr/bin/emlrec");
+argv[0]=(char *)0;
 pidlst=(pid_t *)calloc(iteration,sizeof(pid_t));
 phase=0;
 proceed=true;
@@ -39,20 +46,23 @@ while (proceed==true) {
   switch (phase) {
     case 0      :       //looping forever email receiving processes
       for (int i=0;i<iteration;i++) {
-        int attend;
-
         if (pidlst[i]!=(pid_t)0) {
           if (prc_checkprocess(pidlst[i])==true) 
             continue;
           }
-        attend=(random()%10)+10;
         switch (pidlst[i]=fork()) {
           case -1       :       //trouble trouble?
             pidlst[i]=(pid_t)0;
             break;
           case  0       :
-            (void) rec_getemail(attend);
-            (void) exit(1);
+            (void) rou_alert(0,"Should execv \"%s\"",emlrec);
+            if (execv(emlrec,argv)<0) {
+              (void) rou_alert(0,"%s, Unable to exec command <%s> "
+                                 "(error=<%s>, system trouble?)",
+                                  OPEP,emlrec,strerror(errno));
+              (void) sleep(2);  //to avoid avalanche
+              }
+            (void) exit(1);     //reached only if trouble
             break;
           default       :       
             break;
@@ -92,6 +102,7 @@ while (proceed==true) {
   phase++;
   }
 (void) free(pidlst);
+#undef  OPEP
 }
 /*
 \f
index e4cfd627ccf1e74b76900851f8a29db284ac9024..1c7990191db6d81b84572232ea3d2a497e534ee8 100644 (file)
@@ -18,7 +18,7 @@
 
 //version definition 
 #define VERSION "0.2"
-#define RELEASE "1"
+#define RELEASE "2"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level
@@ -126,7 +126,7 @@ return newpath;
 /********************************************************/
 void rou_valert(const int dlevel,const char *fmt,va_list ap)
 
-#define        DEBMAX  80
+#define        DEBMAX  120
 
 {
 if (debug>=dlevel)