diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2021-06-05 20:47:12 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2021-06-05 20:47:12 +0100 |
commit | 6ede5516b1b75fcbdea965a07240c3d4d02e081a (patch) | |
tree | 4bcc46bf0b79244852a84e6fb62ad1c79e33b8ce | |
parent | 74e249ac9bb950420f90c770850998a0337f14fc (diff) |
Fix SSL creds file watching on kevent platforms (BSDs) for symlinks
-rw-r--r-- | src/src/tls.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/src/tls.c b/src/src/tls.c index e073eadbe..3de417eca 100644 --- a/src/src/tls.c +++ b/src/src/tls.c @@ -158,8 +158,8 @@ return FALSE; # endif # ifdef EXIM_HAVE_KEVENT { -uschar * s; -int fd1, fd2, i, cnt = 0; +uschar * s, * t; +int fd1, fd2, i, j, cnt = 0; struct stat sb; #ifdef OpenBSD struct kevent k_dummy; @@ -209,11 +209,14 @@ for (;;) if (!(S_ISLNK(sb.st_mode))) break; - s = store_get(1024, FALSE); - if ((i = readlink(CCS filename, (void *)s, 1024)) < 0) { s = US"readlink"; goto bad; } - filename = s; - *(s += i) = '\0'; - store_release_above(s+1); + t = store_get(1024, FALSE); + Ustrncpy(t, s, 1022); + j = Ustrlen(s); + t[j++] = '/'; + if ((i = readlink(CCS filename, (void *)(t+j), 1023-j)) < 0) { s = US"readlink"; goto bad; } + filename = t; + *(t += i+j) = '\0'; + store_release_above(t+1); } #ifdef OpenBSD |