summaryrefslogtreecommitdiff
path: root/user/netqmail/0004-notifyfd.patch
blob: d734b141733f6c628b134071cb32b1d35e2ea038 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- netqmail-1.06.old/qmail-send.c
+++ netqmail-1.06/qmail-send.c
@@ -1,5 +1,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
 #include "readwrite.h"
 #include "sig.h"
 #include "direntry.h"
@@ -1521,7 +1523,17 @@
  int nfds;
  struct timeval tv;
  int c;
+ int notifyfd = -1;
 
+  {
+   char *x = getenv("QMAIL_NOTIFY_FD") ;
+   if (x)
+    {
+     unsigned long u;
+     if (scan_ulong(x, &u) && fcntl(u, F_GETFD) >= 0) notifyfd = (int)u;
+    }
+  }
+
  if (chdir(auto_qmail) == -1)
   { log1("alert: cannot start: unable to switch to home directory\n"); _exit(111); }
  if (!getcontrols())
@@ -1567,6 +1579,12 @@
  pass_init();
  todo_init();
  cleanup_init();
+
+ if (notifyfd >=0)
+  {
+   write(notifyfd, "\n", 1);
+   close(notifyfd);
+  }
 
  while (!flagexitasap || !del_canexit())
   {