<https://schmonz.com/qmail/remote> diff --git a/Makefile b/Makefile index 0f0e31a..8042611 100644 --- a/Makefile +++ b/Makefile @@ -1462,11 +1462,11 @@ tcpto.h readwrite.h timeoutconn.h timeoutread.h timeoutwrite.h qmail-rspawn: \ load qmail-rspawn.o spawn.o tcpto_clean.o now.o coe.o sig.a open.a \ -seek.a lock.a wait.a fd.a stralloc.a alloc.a substdio.a error.a str.a \ +seek.a lock.a wait.a fd.a stralloc.a alloc.a substdio.a error.a env.a str.a \ auto_qmail.o auto_uids.o auto_spawn.o ./load qmail-rspawn spawn.o tcpto_clean.o now.o coe.o \ sig.a open.a seek.a lock.a wait.a fd.a stralloc.a alloc.a \ - substdio.a error.a str.a auto_qmail.o auto_uids.o \ + substdio.a error.a env.a str.a auto_qmail.o auto_uids.o \ auto_spawn.o qmail-rspawn.0: \ @@ -1474,7 +1474,7 @@ qmail-rspawn.8 nroff -man qmail-rspawn.8 > qmail-rspawn.0 qmail-rspawn.o: \ -compile qmail-rspawn.c fd.h wait.h substdio.h exit.h fork.h error.h \ +compile qmail-rspawn.c fd.h wait.h substdio.h exit.h fork.h error.h env.h \ tcpto.h ./compile qmail-rspawn.c diff --git a/qmail-rspawn.c b/qmail-rspawn.c index 9d838e6..e064db1 100644 --- a/qmail-rspawn.c +++ b/qmail-rspawn.c @@ -5,6 +5,17 @@ #include "fork.h" #include "error.h" #include "tcpto.h" +#include "env.h" + +static char *qrargs[1] = { 0 }; + +static void setup_qrargs() +{ + if (!qrargs[0]) + qrargs[0] = env_get("QMAILREMOTE"); + if (!qrargs[0]) + qrargs[0] = "qmail-remote"; +} void initialize(argc,argv) int argc; @@ -84,7 +95,9 @@ char *s; char *r; int at; int f; char *(args[5]); - args[0] = "qmail-remote"; + setup_qrargs(); + + args[0] = qrargs[0]; args[1] = r + at + 1; args[2] = s; args[3] = r;