diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:48:04 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:48:04 +0200 |
commit | 89b7b67a13ebb7965cc7f13ad0595e2194a2d34c (patch) | |
tree | 25efd77a90ae87236e6730d8ea3846bbe0fd126f /src/qmail-tcpok.c |
add sqmail-4.2.29asqmail-4.2
Diffstat (limited to 'src/qmail-tcpok.c')
-rw-r--r-- | src/qmail-tcpok.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/qmail-tcpok.c b/src/qmail-tcpok.c new file mode 100644 index 0000000..2935f17 --- /dev/null +++ b/src/qmail-tcpok.c @@ -0,0 +1,36 @@ +#include "logmsg.h" +#include "buffer.h" +#include "lock.h" +#include "open.h" +#include <unistd.h> +#include "auto_qmail.h" +#include "exit.h" + +#define WHO "qmail-tcpok" + +char buf[1024]; /* XXX: must match size in tcpto_clean.c, tcpto.c */ +buffer bo; + +int main() +{ + int fd; + int i; + + if (chdir(auto_qmail) == -1) + logmsg(WHO,111,FATAL,B("unable to chdir to: ",auto_qmail)); + if (chdir("queue/lock") == -1) + logmsg(WHO,111,FATAL,B("unable to chdir to ",auto_qmail,"/queue/lock: ")); + + fd = open_write("tcpto"); + if (fd == -1) + logmsg(WHO,111,FATAL,B("unable to write ",auto_qmail,"/queue/lock/tcpto: ")); + if (lock_ex(fd) == -1) + logmsg(WHO,111,FATAL,B("unable to lock ",auto_qmail,"/queue/lock/tcpto: ")); + + buffer_init(&bo,write,fd,buf,sizeof(buf)); + for (i = 0; i < sizeof(buf); ++i) + buffer_put(&bo,"",1); + if (buffer_flush(&bo) == -1) + logmsg(WHO,111,FATAL,B("unable to clear ",auto_qmail,"/queue/lock/tcpto: ")); + _exit(0); +} |