From 47cd3d6a739d8521b991e6b273caa8912c571b26 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 25 Mar 2025 10:05:28 +0100 Subject: [PATCH] dnsdist: Fix a harmless but ugly TOCTOU in the regression tests As suggested by Miod (thanks!). --- regression-tests.dnsdist/dnsdisttests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/regression-tests.dnsdist/dnsdisttests.py b/regression-tests.dnsdist/dnsdisttests.py index 65b17224ec..a315d8a196 100644 --- a/regression-tests.dnsdist/dnsdisttests.py +++ b/regression-tests.dnsdist/dnsdisttests.py @@ -161,8 +161,11 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): if not cls._yaml_config_template: conf.write("\n") conf.write("setSecurityPollSuffix('')") - elif os.path.exists(luaConfFile): - os.unlink(luaConfFile) + else: + try: + os.unlink(luaConfFile) + except OSError: + pass if cls._skipListeningOnCL: dnsdistcmd = [os.environ['DNSDISTBIN'], '--supervised', '-C', confFile ] -- 2.47.2