diff options
author | John Denker <jsd@av8n.com> | 2012-06-01 18:58:45 -0700 |
---|---|---|
committer | John Denker <jsd@av8n.com> | 2012-06-01 18:58:45 -0700 |
commit | b732a73bc773789894466b0e5320b2f1fe42c7e9 (patch) | |
tree | 385358983f064a1f10a5080b33a3ba13010886db /qmail-tcpok.c | |
parent | 634d365a03cb0581a062cd3cf4db9ae69f1cde26 (diff) |
original, as downloaded from http://www.qmail.org/netqmail-1.06.tar.gz
Diffstat (limited to 'qmail-tcpok.c')
-rw-r--r-- | qmail-tcpok.c | 35 |
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 @@ +#include "strerr.h" +#include "substdio.h" +#include "lock.h" +#include "open.h" +#include "readwrite.h" +#include "auto_qmail.h" +#include "exit.h" + +#define FATAL "qmail-tcpok: fatal: " + +char buf[1024]; /* XXX: must match size in tcpto_clean.c, tcpto.c */ +substdio ss; + +void main() +{ + int fd; + int i; + + if (chdir(auto_qmail) == -1) + strerr_die4sys(111,FATAL,"unable to chdir to ",auto_qmail,": "); + if (chdir("queue/lock") == -1) + strerr_die4sys(111,FATAL,"unable to chdir to ",auto_qmail,"/queue/lock: "); + + fd = open_write("tcpto"); + if (fd == -1) + strerr_die4sys(111,FATAL,"unable to write ",auto_qmail,"/queue/lock/tcpto: "); + if (lock_ex(fd) == -1) + strerr_die4sys(111,FATAL,"unable to lock ",auto_qmail,"/queue/lock/tcpto: "); + + substdio_fdbuf(&ss,write,fd,buf,sizeof buf); + for (i = 0;i < sizeof buf;++i) substdio_put(&ss,"",1); + if (substdio_flush(&ss) == -1) + strerr_die4sys(111,FATAL,"unable to clear ",auto_qmail,"/queue/lock/tcpto: "); + _exit(0); +} |