commit 1f931b2c026025c601d33e720e5d494e44915960
parent 82206056ecfb4003651ef84ca27945fb33f818e8
Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 14 Jun 2020 13:12:11 +0200
Wait for processes and run bmf with verbose on debug.
Diffstat:
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/bmf-milter.c b/bmf-milter.c
@@ -126,13 +126,23 @@ mlfi_helo(SMFICTX *ctx, char *helohost)
perror("open");
_exit(1);
}
- while(dup2(priv->execpipe[0], 1) < 0 && errno == EINTR);
- while(dup2(priv->execpipe[0], 2) < 0 && errno == EINTR);
- }
-
- if (execl("/usr/bin/bmf", "bmf", "-t", "-v", "-v", (char *)NULL) < 0) {
- perror("execl");
- _exit(1);
+ while(dup2(priv->execpipe[0], 1) < 0
+ && errno == EINTR);
+ while(dup2(priv->execpipe[0], 2) < 0
+ && errno == EINTR);
+
+ if (execl("/usr/bin/bmf", "bmf", "-t",
+ (char *)NULL) < 0) {
+ perror("execl");
+ _exit(1);
+ }
+ } else {
+ /* Run with -v(erbose) for debug. */
+ if (execl("/usr/bin/bmf", "bmf", "-t",
+ "-v", (char *)NULL) < 0) {
+ perror("execl");
+ _exit(1);
+ }
}
break;
case -1:
@@ -251,6 +261,7 @@ mlfi_close(SMFICTX *ctx)
if (dodebug)
fprintf(stderr, "Kill pid %d.\n", priv->execpid);
kill(priv->execpid, SIGKILL);
+ waitpid(priv->execpid, NULL, 0);
}
if (dodebug)
fprintf(stderr, "Free priv\n");