From 192f1b0e2bcad654d9b04fc98fa578c4712e25c7 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Wed, 27 Mar 2024 14:07:54 +0100 Subject: [PATCH] - Fix that when the server truncates the pidfile, it does not follow symbolic links. --- daemon/unbound.c | 6 +++++- doc/Changelog | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/daemon/unbound.c b/daemon/unbound.c index 457a08032..b5c7a0d20 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -746,7 +746,11 @@ run_daemon(const char* cfgfile, int cmdline_verbose, int debug_mode, int need_pi if(daemon->pidfile) { int fd; /* truncate pidfile */ - fd = open(daemon->pidfile, O_WRONLY | O_TRUNC, 0644); + fd = open(daemon->pidfile, O_WRONLY | O_TRUNC +#ifdef O_NOFOLLOW + | O_NOFOLLOW +#endif + , 0644); if(fd != -1) close(fd); /* delete pidfile */ diff --git a/doc/Changelog b/doc/Changelog index 3fbd27026..05be2e56f 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,8 @@ - Fix for #1032, add safeguard to make table space positive. - Fix comment in lruhash space function. - Fix to add unit test for lruhash space that exercises the routines. + - Fix that when the server truncates the pidfile, it does not follow + symbolic links. 25 March 2024: Yorgos - Merge #831 from Pierre4012: Improve Windows NSIS installer -- 2.47.3