]> git.pld-linux.org Git - packages/ettercap.git/blob - ettercap-no-common.patch
rebuild with openssl 3.0.0
[packages/ettercap.git] / ettercap-no-common.patch
1 From 2168090f5b023573ebea0f83574950401ed5d67b Mon Sep 17 00:00:00 2001
2 From: Alexander Koeppe <format_c@online.de>
3 Date: Wed, 29 Jan 2020 21:09:31 +0100
4 Subject: [PATCH] define EC_PTHREAD_NULL as global heap variable
5
6 ---
7  include/ec_globals.h | 7 +++++++
8  include/ec_threads.h | 2 +-
9  src/ec_globals.c     | 3 +++
10  3 files changed, 11 insertions(+), 1 deletion(-)
11
12 diff --git a/include/ec_globals.h b/include/ec_globals.h
13 index 5033f5dc0..45e12514c 100644
14 --- a/include/ec_globals.h
15 +++ b/include/ec_globals.h
16 @@ -176,6 +176,11 @@ struct wifi_env {
17         size_t wkey_len;
18  };
19  
20 +/* threads structure */
21 +struct thread_env {
22 +   pthread_t ec_pthread_null;
23 +};
24 +
25  /* the globals container */
26  struct ec_globals {
27     struct ec_conf *conf;
28 @@ -191,6 +196,7 @@ struct ec_globals {
29     struct target_env *t1;
30     struct target_env *t2;
31     struct wifi_env *wifi;
32 +   struct thread_env *thread;
33     LIST_HEAD(, hosts_list) hosts_list;
34     TAILQ_HEAD(gbl_ptail, host_profile) profiles_list_head;
35     struct filter_list *filters;
36 @@ -213,6 +219,7 @@ EC_API_EXTERN struct ec_globals *ec_gbls;
37  #define EC_GBL_TARGET1        (EC_GBLS->t1)
38  #define EC_GBL_TARGET2        (EC_GBLS->t2)
39  #define EC_GBL_WIFI           (EC_GBLS->wifi)
40 +#define EC_GBL_THREAD         (EC_GBLS->thread)
41  #define EC_GBL_HOSTLIST       (EC_GBLS->hosts_list)
42  #define EC_GBL_PROFILES       (EC_GBLS->profiles_list_head)
43  #define EC_GBL_FILTERS        &(EC_GBLS->filters)
44 diff --git a/include/ec_threads.h b/include/ec_threads.h
45 index 6cd2c1084..f63f3ee3a 100644
46 --- a/include/ec_threads.h
47 +++ b/include/ec_threads.h
48 @@ -12,7 +12,7 @@ struct ec_thread {
49  };
50  
51  /* a value to be used to return errors in fuctcions using pthread_t values */
52 -pthread_t EC_PTHREAD_NULL;
53 +#define EC_PTHREAD_NULL EC_GBL_THREAD->ec_pthread_null
54  #define EC_PTHREAD_SELF EC_PTHREAD_NULL
55  #define PTHREAD_ID(id)  (*(unsigned long*)&(id)) 
56  
57 diff --git a/src/ec_globals.c b/src/ec_globals.c
58 index 1bc313c15..e45dba5cf 100644
59 --- a/src/ec_globals.c
60 +++ b/src/ec_globals.c
61 @@ -52,6 +52,7 @@ void ec_globals_alloc(void)
62     SAFE_CALLOC(ec_gbls->t1, 1, sizeof(struct target_env));
63     SAFE_CALLOC(ec_gbls->t2, 1, sizeof(struct target_env));
64     SAFE_CALLOC(ec_gbls->wifi, 1, sizeof(struct wifi_env));
65 +   SAFE_CALLOC(ec_gbls->thread, 1, sizeof(struct thread_env));
66     /* filter list entries are allocated as needed */
67     ec_gbls->filters = NULL;
68  
69 @@ -72,6 +73,8 @@ void ec_globals_free(void)
70     EC_GBL_FREE(ec_gbls->bridge);
71     EC_GBL_FREE(ec_gbls->sm);
72     EC_GBL_FREE(ec_gbls->filters);
73 +   EC_GBL_FREE(ec_gbls->wifi);
74 +   EC_GBL_FREE(ec_gbls->thread);
75  
76     free_ip_list(ec_gbls->t1);
77     EC_GBL_FREE(ec_gbls->t1);
This page took 0.101429 seconds and 3 git commands to generate.