summaryrefslogtreecommitdiff
path: root/src/tcpto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tcpto.c')
-rw-r--r--src/tcpto.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tcpto.c b/src/tcpto.c
index 82b102f..a600e59 100644
--- a/src/tcpto.c
+++ b/src/tcpto.c
@@ -10,20 +10,25 @@
#include "byte.h"
#include "datetime.h"
#include "qmail.h"
+#include "auto_qmail.h"
+#include "auto_queue.h"
char tcpto_buf[BUFSIZE_LINE];
static int flagwasthere;
static int fdlock;
+void die_home() { _exit(61); }
+void die_queue() { _exit(62); }
+
static int getbuf()
{
int r;
int fd;
- fdlock = open_write("queue/lock/tcpto");
+ fdlock = open_write("lock/tcpto");
if (fdlock == -1) return 0;
- fd = open_read("queue/lock/tcpto");
+ fd = open_read("lock/tcpto");
if (fd == -1) { close(fdlock); return 0; }
if (lock_ex(fdlock) == -1) { close(fdlock); close(fd); return 0; }
r = read(fd,tcpto_buf,sizeof(tcpto_buf));
@@ -43,6 +48,8 @@ int tcpto(struct ip_mx *ix)
char *record;
datetime_sec when;
+ if (chdir(auto_queue) == -1) die_queue();
+ if (chdir("queue") == -1) die_queue();
flagwasthere = 0;
n = getbuf();
@@ -66,6 +73,9 @@ int tcpto(struct ip_mx *ix)
}
record += 32;
}
+
+ if (chdir(auto_qmail) == -1) die_home();
+
return 0;
}