• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From f446258f0269a62289cca0210157cb8558d0edc3 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Tue, 16 May 2023 23:40:42 +0200
4Subject: [PATCH 1/1] hostip: include easy_lock.h before using
5 GLOBAL_INIT_IS_THREADSAFE
6
7Since that header file is the only place that define can be defined.
8
9Reported-by: Marc Deslauriers
10
11Follow-up to 13718030ad4b3209
12
13Closes #11121
14
15Conflict:context adapt
16Reference:https://github.com/curl/curl/commit/f446258f0269a62289cca0210157cb8558d0edc3
17---
18 lib/hostip.c | 10 ++++------
19 lib/hostip.h |  9 ---------
20 2 files changed, 4 insertions(+), 15 deletions(-)
21
22diff --git a/lib/hostip.c b/lib/hostip.c
23index 615f36c16..4ff348436 100644
24--- a/lib/hostip.c
25+++ b/lib/hostip.c
26@@ -70,6 +70,8 @@
27 #include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
28 #endif
29
30+#include "easy_lock.h"
31+
32 #if defined(CURLRES_SYNCH) &&                   \
33   defined(HAVE_ALARM) &&                        \
34   defined(SIGALRM) &&                           \
35@@ -79,10 +81,6 @@
36 #define USE_ALARM_TIMEOUT
37 #endif
38
39-#ifdef USE_ALARM_TIMEOUT
40-#include "easy_lock.h"
41-#endif
42-
43 #define MAX_HOSTCACHE_LEN (255 + 7) /* max FQDN + colon + port number + zero */
44
45 /*
46@@ -289,8 +287,8 @@ void Curl_hostcache_prune(struct Curl_easy *data)
47 /* Beware this is a global and unique instance. This is used to store the
48    return address that we can jump back to from inside a signal handler. This
49    is not thread-safe stuff. */
50-sigjmp_buf curl_jmpenv;
51-curl_simple_lock curl_jmpenv_lock;
52+static sigjmp_buf curl_jmpenv;
53+static curl_simple_lock curl_jmpenv_lock;
54 #endif
55
56 /* lookup address, returns entry if found and not stale */
57diff --git a/lib/hostip.h b/lib/hostip.h
58index 4b5481f65..0dd19e87c 100644
59--- a/lib/hostip.h
60+++ b/lib/hostip.h
61@@ -186,15 +186,6 @@ Curl_cache_addr(struct Curl_easy *data, struct Curl_addrinfo *addr,
62 #define CURL_INADDR_NONE INADDR_NONE
63 #endif
64
65-#ifdef HAVE_SIGSETJMP
66-/* Forward-declaration of variable defined in hostip.c. Beware this
67- * is a global and unique instance. This is used to store the return
68- * address that we can jump back to from inside a signal handler.
69- * This is not thread-safe stuff.
70- */
71-extern sigjmp_buf curl_jmpenv;
72-#endif
73-
74 /*
75  * Function provided by the resolver backend to set DNS servers to use.
76  */
77--
782.33.0
79
80