summaryrefslogblamecommitdiff
path: root/user/netqmail/0004-notifyfd.patch
blob: d734b141733f6c628b134071cb32b1d35e2ea038 (plain) (tree)







































                                                                                     
--- 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())
   {