summaryrefslogtreecommitdiff
path: root/src/tcpto.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-18 15:15:18 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-18 15:15:18 +0200
commit7b4d3ab22988d021d5f12b81aec746f7e486fa52 (patch)
tree651e78e316411a39baadadb1cfaca450e1351c7f /src/tcpto.c
parent25f74781424d5e13f0211c08cce8c2a1d60b9aec (diff)
update to 4.3.09
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;
}