summaryrefslogtreecommitdiffstats
path: root/qmail-tcpok.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
committermanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
commit69aec538b456402170dc723af417ba5c05389c32 (patch)
treee6f34c543f17c6392447ea337b2e2868212424d1 /qmail-tcpok.c
downloadqmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz
qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2
qmail-69aec538b456402170dc723af417ba5c05389c32.zip
qmail 1.03 import
Diffstat (limited to 'qmail-tcpok.c')
-rw-r--r--qmail-tcpok.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/qmail-tcpok.c b/qmail-tcpok.c
new file mode 100644
index 0000000..a9b9652
--- /dev/null
+++ b/qmail-tcpok.c
@@ -0,0 +1,35 @@
1#include "strerr.h"
2#include "substdio.h"
3#include "lock.h"
4#include "open.h"
5#include "readwrite.h"
6#include "auto_qmail.h"
7#include "exit.h"
8
9#define FATAL "qmail-tcpok: fatal: "
10
11char buf[1024]; /* XXX: must match size in tcpto_clean.c, tcpto.c */
12substdio ss;
13
14void main()
15{
16 int fd;
17 int i;
18
19 if (chdir(auto_qmail) == -1)
20 strerr_die4sys(111,FATAL,"unable to chdir to ",auto_qmail,": ");
21 if (chdir("queue/lock") == -1)
22 strerr_die4sys(111,FATAL,"unable to chdir to ",auto_qmail,"/queue/lock: ");
23
24 fd = open_write("tcpto");
25 if (fd == -1)
26 strerr_die4sys(111,FATAL,"unable to write ",auto_qmail,"/queue/lock/tcpto: ");
27 if (lock_ex(fd) == -1)
28 strerr_die4sys(111,FATAL,"unable to lock ",auto_qmail,"/queue/lock/tcpto: ");
29
30 substdio_fdbuf(&ss,write,fd,buf,sizeof buf);
31 for (i = 0;i < sizeof buf;++i) substdio_put(&ss,"",1);
32 if (substdio_flush(&ss) == -1)
33 strerr_die4sys(111,FATAL,"unable to clear ",auto_qmail,"/queue/lock/tcpto: ");
34 _exit(0);
35}