diff options
Diffstat (limited to 'recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch')
-rw-r--r-- | recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch b/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch new file mode 100644 index 00000000..1ea8da9c --- /dev/null +++ b/recipes-extended/nagios/nagios-core/0001-fix-segment-fault.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From 65e4539c6eca215d8d79ef8acc5c8842b886752a Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 3 Sep 2018 13:15:29 +0800 | ||
4 | Subject: [PATCH] fix segment fault | ||
5 | |||
6 | When using strdup(dirname(cfgfile)) directly, we will have segment | ||
7 | fault. This happens at least for glibc 2.28. So we do it step by | ||
8 | step, and this would avoid the segment fault. | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | |||
12 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
13 | --- | ||
14 | include/shared.h | 1 + | ||
15 | xdata/xodtemplate.c | 4 +++- | ||
16 | 2 files changed, 4 insertions(+), 1 deletion(-) | ||
17 | |||
18 | diff --git a/include/shared.h b/include/shared.h | ||
19 | index 1dfa0c7..0188c7d 100644 | ||
20 | --- a/include/shared.h | ||
21 | +++ b/include/shared.h | ||
22 | @@ -31,6 +31,7 @@ | ||
23 | #include <wchar.h> | ||
24 | #include <locale.h> | ||
25 | #include <limits.h> | ||
26 | +#include <libgen.h> | ||
27 | |||
28 | #include <time.h> | ||
29 | #include "lib/libnagios.h" | ||
30 | diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c | ||
31 | index 33d51f4..da32e69 100644 | ||
32 | --- a/xdata/xodtemplate.c | ||
33 | +++ b/xdata/xodtemplate.c | ||
34 | @@ -187,6 +187,7 @@ static void xodtemplate_free_template_skiplists(void) { | ||
35 | int xodtemplate_read_config_data(const char *main_config_file, int options) { | ||
36 | #ifdef NSCORE | ||
37 | char *cfgfile = NULL; | ||
38 | + char *cfgfile_dir = NULL; | ||
39 | char *config_base_dir = NULL; | ||
40 | char *input = NULL; | ||
41 | char *var = NULL; | ||
42 | @@ -261,7 +262,8 @@ int xodtemplate_read_config_data(const char *main_config_file, int options) { | ||
43 | printf("Unable to allocate memory!\n"); | ||
44 | return ERROR; | ||
45 | } | ||
46 | - config_base_dir = (char *)strdup(dirname(cfgfile)); | ||
47 | + cfgfile_dir = dirname(cfgfile); | ||
48 | + config_base_dir = (char *)strdup(cfgfile_dir); | ||
49 | my_free(cfgfile); | ||
50 | |||
51 | /* open the main config file for reading (we need to find all the config files to read) */ | ||
52 | -- | ||
53 | 2.7.4 | ||
54 | |||