diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0014-src-basic-missing.h-check-for-missing-strndupa.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0014-src-basic-missing.h-check-for-missing-strndupa.patch | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0014-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0014-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 0000000000..9f62cbbe69 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0014-src-basic-missing.h-check-for-missing-strndupa.patch | |||
@@ -0,0 +1,118 @@ | |||
1 | From 33be9052315cc4ec8e929fa238e1f0cc0161ad07 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Wed, 28 Feb 2018 21:15:28 -0800 | ||
4 | Subject: [PATCH] src/basic/missing.h: check for missing strndupa | ||
5 | |||
6 | include missing.h for definition of strndupa | ||
7 | |||
8 | Upstream-Status: Pending | ||
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.h | 11 +++++++++++ | ||
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, 17 insertions(+) | ||
21 | |||
22 | diff --git a/meson.build b/meson.build | ||
23 | index 4eabaafe8..12811b3f3 100644 | ||
24 | --- a/meson.build | ||
25 | +++ b/meson.build | ||
26 | @@ -525,6 +525,7 @@ foreach ident : [ | ||
27 | ['bpf', '''#include <sys/syscall.h> | ||
28 | #include <unistd.h>'''], | ||
29 | ['explicit_bzero' , '''#include <string.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.h b/src/basic/missing.h | ||
35 | index 84d6d9167..07a8c8364 100644 | ||
36 | --- a/src/basic/missing.h | ||
37 | +++ b/src/basic/missing.h | ||
38 | @@ -1187,6 +1187,17 @@ struct input_mask { | ||
39 | typedef int32_t key_serial_t; | ||
40 | #endif | ||
41 | |||
42 | +#if ! HAVE_STRNDUPA | ||
43 | +#define strndupa(s, n) \ | ||
44 | + ({ \ | ||
45 | + const char *__old = (s); \ | ||
46 | + size_t __len = strnlen(__old, (n)); \ | ||
47 | + char *__new = (char *)alloca(__len + 1); \ | ||
48 | + __new[__len] = '\0'; \ | ||
49 | + (char *)memcpy(__new, __old, __len); \ | ||
50 | + }) | ||
51 | +#endif | ||
52 | + | ||
53 | #ifndef KEYCTL_JOIN_SESSION_KEYRING | ||
54 | #define KEYCTL_JOIN_SESSION_KEYRING 1 | ||
55 | #endif | ||
56 | diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c | ||
57 | index de4746c86..d51518a5a 100644 | ||
58 | --- a/src/basic/mkdir.c | ||
59 | +++ b/src/basic/mkdir.c | ||
60 | @@ -30,6 +30,7 @@ | ||
61 | #include "path-util.h" | ||
62 | #include "stat-util.h" | ||
63 | #include "user-util.h" | ||
64 | +#include "missing.h" | ||
65 | |||
66 | int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, bool follow_symlink, mkdir_func_t _mkdir) { | ||
67 | struct stat st; | ||
68 | diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c | ||
69 | index 2c22753de..97533721d 100644 | ||
70 | --- a/src/basic/parse-util.c | ||
71 | +++ b/src/basic/parse-util.c | ||
72 | @@ -33,6 +33,7 @@ | ||
73 | #include "parse-util.h" | ||
74 | #include "process-util.h" | ||
75 | #include "string-util.h" | ||
76 | +#include "missing.h" | ||
77 | |||
78 | int parse_boolean(const char *v) { | ||
79 | assert(v); | ||
80 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c | ||
81 | index 9bb42cc7b..23bbd9e67 100644 | ||
82 | --- a/src/basic/procfs-util.c | ||
83 | +++ b/src/basic/procfs-util.c | ||
84 | @@ -9,6 +9,7 @@ | ||
85 | #include "procfs-util.h" | ||
86 | #include "stdio-util.h" | ||
87 | #include "string-util.h" | ||
88 | +#include "missing.h" | ||
89 | |||
90 | int procfs_tasks_get_limit(uint64_t *ret) { | ||
91 | _cleanup_free_ char *value = NULL; | ||
92 | diff --git a/src/shared/pager.c b/src/shared/pager.c | ||
93 | index 75db3c985..84f06bf7d 100644 | ||
94 | --- a/src/shared/pager.c | ||
95 | +++ b/src/shared/pager.c | ||
96 | @@ -39,6 +39,7 @@ | ||
97 | #include "string-util.h" | ||
98 | #include "strv.h" | ||
99 | #include "terminal-util.h" | ||
100 | +#include "missing.h" | ||
101 | |||
102 | static pid_t pager_pid = 0; | ||
103 | |||
104 | diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c | ||
105 | index c38b7cc98..8ec6bf08d 100644 | ||
106 | --- a/src/shared/uid-range.c | ||
107 | +++ b/src/shared/uid-range.c | ||
108 | @@ -25,6 +25,7 @@ | ||
109 | #include "macro.h" | ||
110 | #include "uid-range.h" | ||
111 | #include "user-util.h" | ||
112 | +#include "missing.h" | ||
113 | |||
114 | static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { | ||
115 | assert(range); | ||
116 | -- | ||
117 | 2.13.0 | ||
118 | |||