From 4b5677da22e0f34442223ff9396784455a55034a Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Fri, 22 Jun 2018 13:41:10 +0100 Subject: [PATCH] Bound the number of attempts my_mkstemps tries to compute a file name Without this bound there are unreachable instructions at the end of the function. --- src/util/tempfile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/tempfile.cpp b/src/util/tempfile.cpp index a9f761fb882..2319c73fdad 100644 --- a/src/util/tempfile.cpp +++ b/src/util/tempfile.cpp @@ -62,7 +62,7 @@ int my_mkstemps(char *template_str, int suffix_len) static long long unsigned int random_state; random_state+=getpid()+123; - for(unsigned attempt=0; ; ++attempt) + for(unsigned attempt = 0; attempt < 1000; ++attempt) { unsigned long long number=random_state;