s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
qmail-tcpok.c
Go to the documentation of this file.
1#include "logmsg.h"
2#include "buffer.h"
3#include "lock.h"
4#include "open.h"
5#include <unistd.h>
6#include "auto_qmail.h"
7#include "exit.h"
8
9#define WHO "qmail-tcpok"
10
11char buf[1024]; /* XXX: must match size in tcpto_clean.c, tcpto.c */
12buffer bo;
13
14int main()
15{
16 int fd;
17 int i;
18
19 if (chdir(auto_qmail) == -1)
20 logmsg(WHO,111,FATAL,B("unable to chdir to: ",auto_qmail));
21 if (chdir("queue/lock") == -1)
22 logmsg(WHO,111,FATAL,B("unable to chdir to ",auto_qmail,"/queue/lock: "));
23
24 fd = open_write("tcpto");
25 if (fd == -1)
26 logmsg(WHO,111,FATAL,B("unable to write ",auto_qmail,"/queue/lock/tcpto: "));
27 if (lock_ex(fd) == -1)
28 logmsg(WHO,111,FATAL,B("unable to lock ",auto_qmail,"/queue/lock/tcpto: "));
29
30 buffer_init(&bo,write,fd,buf,sizeof(buf));
31 for (i = 0; i < sizeof(buf); ++i)
32 buffer_put(&bo,"",1);
33 if (buffer_flush(&bo) == -1)
34 logmsg(WHO,111,FATAL,B("unable to clear ",auto_qmail,"/queue/lock/tcpto: "));
35 _exit(0);
36}
char auto_qmail[]
void _exit()
int fd
char buf[1024]
Definition: qmail-tcpok.c:11
buffer bo
Definition: qmail-tcpok.c:12
#define WHO
Definition: qmail-tcpok.c:9
int main()
Definition: qmail-tcpok.c:14
void write()