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