From: Jeremy Harris Date: Sat, 10 Oct 2020 15:06:02 +0000 (+0100) Subject: kevent: handle OpenBSD API anomaly X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/fe192666f5de206b57cbbe07a4d90fd4868ea90b kevent: handle OpenBSD API anomaly --- diff --git a/src/src/tls.c b/src/src/tls.c index 5adab7c7b..38d695d20 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 84227b9d3..a6ae28447 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