diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 0000000000..f20897b5f8 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch | |||
@@ -0,0 +1,116 @@ | |||
1 | From 399fd3eda3045636a70da438a0fd1406cc332ed1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 14:18:21 +0800 | ||
4 | Subject: [PATCH 05/24] src/basic/missing.h: check for missing strndupa | ||
5 | |||
6 | include missing.h for definition of strndupa | ||
7 | |||
8 | Upstream-Status: Inappropriate [musl specific] | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
12 | --- | ||
13 | meson.build | 1 + | ||
14 | src/basic/missing_stdlib.h | 12 ++++++++++++ | ||
15 | src/basic/mkdir.c | 1 + | ||
16 | src/basic/parse-util.c | 1 + | ||
17 | src/basic/procfs-util.c | 1 + | ||
18 | src/shared/pager.c | 1 + | ||
19 | src/shared/uid-range.c | 1 + | ||
20 | 7 files changed, 18 insertions(+) | ||
21 | |||
22 | diff --git a/meson.build b/meson.build | ||
23 | index 44b24ee..70fb218 100644 | ||
24 | --- a/meson.build | ||
25 | +++ b/meson.build | ||
26 | @@ -558,6 +558,7 @@ foreach ident : [ | ||
27 | #include <unistd.h>'''], | ||
28 | ['explicit_bzero' , '''#include <string.h>'''], | ||
29 | ['reallocarray', '''#include <malloc.h>'''], | ||
30 | + ['strndupa' , '''#include <string.h>'''], | ||
31 | ] | ||
32 | |||
33 | have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') | ||
34 | diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h | ||
35 | index c0ffe86..d50274b 100644 | ||
36 | --- a/src/basic/missing_stdlib.h | ||
37 | +++ b/src/basic/missing_stdlib.h | ||
38 | @@ -11,3 +11,15 @@ | ||
39 | # define secure_getenv getenv | ||
40 | # endif | ||
41 | #endif | ||
42 | + | ||
43 | +/* string.h */ | ||
44 | +#if ! HAVE_STRNDUPA | ||
45 | +#define strndupa(s, n) \ | ||
46 | + ({ \ | ||
47 | + const char *__old = (s); \ | ||
48 | + size_t __len = strnlen(__old, (n)); \ | ||
49 | + char *__new = (char *)alloca(__len + 1); \ | ||
50 | + __new[__len] = '\0'; \ | ||
51 | + (char *)memcpy(__new, __old, __len); \ | ||
52 | + }) | ||
53 | +#endif | ||
54 | diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c | ||
55 | index 4bb65d5..3038ab9 100644 | ||
56 | --- a/src/basic/mkdir.c | ||
57 | +++ b/src/basic/mkdir.c | ||
58 | @@ -13,6 +13,7 @@ | ||
59 | #include "stat-util.h" | ||
60 | #include "stdio-util.h" | ||
61 | #include "user-util.h" | ||
62 | +#include "missing.h" | ||
63 | |||
64 | int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags, mkdir_func_t _mkdir) { | ||
65 | struct stat st; | ||
66 | diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c | ||
67 | index 87724af..d9c53bc 100644 | ||
68 | --- a/src/basic/parse-util.c | ||
69 | +++ b/src/basic/parse-util.c | ||
70 | @@ -19,6 +19,7 @@ | ||
71 | #include "process-util.h" | ||
72 | #include "stat-util.h" | ||
73 | #include "string-util.h" | ||
74 | +#include "missing.h" | ||
75 | |||
76 | int parse_boolean(const char *v) { | ||
77 | if (!v) | ||
78 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c | ||
79 | index 7aaf95b..42ce53d 100644 | ||
80 | --- a/src/basic/procfs-util.c | ||
81 | +++ b/src/basic/procfs-util.c | ||
82 | @@ -11,6 +11,7 @@ | ||
83 | #include "procfs-util.h" | ||
84 | #include "stdio-util.h" | ||
85 | #include "string-util.h" | ||
86 | +#include "missing.h" | ||
87 | |||
88 | int procfs_tasks_get_limit(uint64_t *ret) { | ||
89 | _cleanup_free_ char *value = NULL; | ||
90 | diff --git a/src/shared/pager.c b/src/shared/pager.c | ||
91 | index bf2597e..fa9e321 100644 | ||
92 | --- a/src/shared/pager.c | ||
93 | +++ b/src/shared/pager.c | ||
94 | @@ -24,6 +24,7 @@ | ||
95 | #include "string-util.h" | ||
96 | #include "strv.h" | ||
97 | #include "terminal-util.h" | ||
98 | +#include "missing.h" | ||
99 | |||
100 | static pid_t pager_pid = 0; | ||
101 | |||
102 | diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c | ||
103 | index 5fa7bd2..9c63b9e 100644 | ||
104 | --- a/src/shared/uid-range.c | ||
105 | +++ b/src/shared/uid-range.c | ||
106 | @@ -9,6 +9,7 @@ | ||
107 | #include "uid-range.h" | ||
108 | #include "user-util.h" | ||
109 | #include "util.h" | ||
110 | +#include "missing.h" | ||
111 | |||
112 | static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { | ||
113 | assert(range); | ||
114 | -- | ||
115 | 2.7.4 | ||
116 | |||