[exim-cvs] kevent: handle OpenBSD API anomaly

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] kevent: handle OpenBSD API anomaly
Gitweb: https://git.exim.org/exim.git/commitdiff/fe192666f5de206b57cbbe07a4d90fd4868ea90b
Commit:     fe192666f5de206b57cbbe07a4d90fd4868ea90b
Parent:     8c6732214b2c585148ead48b668a2cd819bde158
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Oct 10 16:06:02 2020 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sat Oct 10 16:09:13 2020 +0100


    kevent: handle OpenBSD API anomaly
---
 src/src/tls.c | 15 ++++++++++++---
 test/runtest  |  3 ++-
 2 files changed, 14 insertions(+), 4 deletions(-)


diff --git a/src/src/tls.c b/src/src/tls.c
index 5adab7c..38d695d 100644
--- a/src/src/tls.c
+++ b/src/src/tls.c
@@ -159,6 +159,9 @@ return FALSE;
uschar * s;
int fd1, fd2, i, cnt = 0;
struct stat sb;
+#ifdef OpenBSD
+struct kevent k_dummy;
+#endif

errno = 0;
if (Ustrcmp(filename, "system,cache") == 0) return TRUE;
@@ -204,13 +207,19 @@ for (;;)
if (!(S_ISLNK(sb.st_mode))) break;

s = store_get(1024, FALSE);
- if ((i = readlink(CCS filename, s, 1024)) < 0) { s = US"readlink"; goto bad; }
+ if ((i = readlink(CCS filename, (void *)s, 1024)) < 0) { s = US"readlink"; goto bad; }
filename = s;
*(s += i) = '\0';
store_release_above(s+1);
}

-if (kevent(tls_watch_fd, &kev[kev_used-cnt], cnt, NULL, 0, NULL) >= 0)
+if (kevent(tls_watch_fd, &kev[kev_used-cnt], cnt,
+#ifdef OpenBSD
+        &k_dummy, 1,
+#else
+        NULL, 0,
+#endif
+        NULL) >= 0)
   return TRUE;
 s = US"kevent";


@@ -318,7 +327,7 @@ if (tls_watch_fd < 0) return;

 #ifdef EXIM_HAVE_KEVENT
 /* Close the files we had open for kevent */
-for (int fd, i = 0; i < kev_used; i++)
+for (int i = 0; i < kev_used; i++)
   {
   (void) close((int) kev[i].ident);
   kev[i].ident = (uintptr_t)-1;
diff --git a/test/runtest b/test/runtest
index 84227b9..a6ae284 100755
--- a/test/runtest
+++ b/test/runtest
@@ -1087,9 +1087,10 @@ RESET_AFTER_EXTRA_LINE_READ:
     s/^GnuTLS using default session cipher\/priority "NORMAL"$/TLS: not preloading cipher list for server/;
     next if /^GnuTLS<2>: added \d+ protocols, \d+ ciphersuites, \d+ sig algos and \d+ groups into priority list$/;


-    # only kevent platforms (FreeBSD) say this
+    # only kevent platforms (FreeBSD, OpenBSD) say this
     next if /^watch dir/;
     next if /^watch file .*\/usr\/local/;
+    next if /^watch file .*\/etc\/ssl/;


     # TLS preload
     # there happen in different orders for OpenSSL/GnuTLS/noTLS