diff options
Diffstat (limited to 'meta-oe/recipes-core/systemd/systemd')
-rw-r--r-- | meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch | 380 | ||||
-rw-r--r-- | meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch | 19 |
2 files changed, 399 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch b/meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch new file mode 100644 index 000000000..1c95023bb --- /dev/null +++ b/meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch | |||
@@ -0,0 +1,380 @@ | |||
1 | Patch from Henning. %m is a glibc only thing. For uclibc we need to do it | ||
2 | differently. So we use static strings instead of mallocing them and free'ing | ||
3 | |||
4 | I dont know if upstream systemd have plans to make systemd work on non | ||
5 | glibc system libraries if not then this patch would not make sense for | ||
6 | upstream | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | |||
10 | Index: git/src/mount-setup.c | ||
11 | =================================================================== | ||
12 | --- git.orig/src/mount-setup.c 2012-01-25 21:27:23.000000000 -0800 | ||
13 | +++ git/src/mount-setup.c 2012-01-25 21:59:43.897031326 -0800 | ||
14 | @@ -182,10 +182,10 @@ | ||
15 | (void) fgets(buf, sizeof(buf), f); | ||
16 | |||
17 | for (;;) { | ||
18 | - char *controller; | ||
19 | + char controller[30]; | ||
20 | int enabled = 0; | ||
21 | |||
22 | - if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) { | ||
23 | + if (fscanf(f, "%s %*i %*i %i", controller, &enabled) != 2) { | ||
24 | |||
25 | if (feof(f)) | ||
26 | break; | ||
27 | @@ -196,14 +196,12 @@ | ||
28 | } | ||
29 | |||
30 | if (!enabled) { | ||
31 | - free(controller); | ||
32 | continue; | ||
33 | } | ||
34 | |||
35 | r = set_put(controllers, controller); | ||
36 | if (r < 0) { | ||
37 | log_error("Failed to add controller to set."); | ||
38 | - free(controller); | ||
39 | goto finish; | ||
40 | } | ||
41 | } | ||
42 | @@ -273,7 +271,6 @@ | ||
43 | p.fatal = false; | ||
44 | |||
45 | r = mount_one(&p, true); | ||
46 | - free(controller); | ||
47 | free(where); | ||
48 | |||
49 | if (r < 0) { | ||
50 | Index: git/src/socket-util.c | ||
51 | =================================================================== | ||
52 | --- git.orig/src/socket-util.c 2012-01-25 21:27:23.000000000 -0800 | ||
53 | +++ git/src/socket-util.c 2012-01-25 21:59:43.897031326 -0800 | ||
54 | @@ -192,7 +192,7 @@ | ||
55 | int socket_address_parse_netlink(SocketAddress *a, const char *s) { | ||
56 | int family; | ||
57 | unsigned group = 0; | ||
58 | - char* sfamily = NULL; | ||
59 | + char sfamily[50]; | ||
60 | assert(a); | ||
61 | assert(s); | ||
62 | |||
63 | @@ -200,17 +200,14 @@ | ||
64 | a->type = SOCK_RAW; | ||
65 | |||
66 | errno = 0; | ||
67 | - if (sscanf(s, "%ms %u", &sfamily, &group) < 1) | ||
68 | + if (sscanf(s, "%49s %u", &sfamily, &group) < 1) | ||
69 | return errno ? -errno : -EINVAL; | ||
70 | |||
71 | if ((family = netlink_family_from_string(sfamily)) < 0) | ||
72 | if (safe_atoi(sfamily, &family) < 0) { | ||
73 | - free(sfamily); | ||
74 | return -EINVAL; | ||
75 | } | ||
76 | |||
77 | - free(sfamily); | ||
78 | - | ||
79 | a->sockaddr.nl.nl_family = AF_NETLINK; | ||
80 | a->sockaddr.nl.nl_groups = group; | ||
81 | |||
82 | Index: git/src/swap.c | ||
83 | =================================================================== | ||
84 | --- git.orig/src/swap.c 2012-01-25 21:27:23.000000000 -0800 | ||
85 | +++ git/src/swap.c 2012-01-25 21:59:43.897031326 -0800 | ||
86 | @@ -1049,11 +1049,12 @@ | ||
87 | (void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n"); | ||
88 | |||
89 | for (i = 1;; i++) { | ||
90 | - char *dev = NULL, *d; | ||
91 | + char *d; | ||
92 | + char dev[20]; | ||
93 | int prio = 0, k; | ||
94 | |||
95 | if ((k = fscanf(m->proc_swaps, | ||
96 | - "%ms " /* device/file */ | ||
97 | + "%19s " /* device/file */ | ||
98 | "%*s " /* type of swap */ | ||
99 | "%*s " /* swap size */ | ||
100 | "%*s " /* used */ | ||
101 | @@ -1064,12 +1065,10 @@ | ||
102 | break; | ||
103 | |||
104 | log_warning("Failed to parse /proc/swaps:%u.", i); | ||
105 | - free(dev); | ||
106 | continue; | ||
107 | } | ||
108 | |||
109 | d = cunescape(dev); | ||
110 | - free(dev); | ||
111 | |||
112 | if (!d) | ||
113 | return -ENOMEM; | ||
114 | Index: git/src/tmpfiles.c | ||
115 | =================================================================== | ||
116 | --- git.orig/src/tmpfiles.c 2012-01-25 21:27:23.000000000 -0800 | ||
117 | +++ git/src/tmpfiles.c 2012-01-25 22:06:58.649052774 -0800 | ||
118 | @@ -73,8 +73,8 @@ | ||
119 | typedef struct Item { | ||
120 | ItemType type; | ||
121 | |||
122 | - char *path; | ||
123 | - char *argument; | ||
124 | + char path[50]; | ||
125 | + char argument[50]; | ||
126 | uid_t uid; | ||
127 | gid_t gid; | ||
128 | mode_t mode; | ||
129 | @@ -822,7 +822,6 @@ | ||
130 | case CREATE_CHAR_DEVICE: | ||
131 | case CREATE_BLOCK_DEVICE: | ||
132 | case IGNORE_PATH: | ||
133 | - case RELABEL_PATH: | ||
134 | case RECURSIVE_RELABEL_PATH: | ||
135 | case WRITE_FILE: | ||
136 | break; | ||
137 | @@ -858,8 +857,6 @@ | ||
138 | static void item_free(Item *i) { | ||
139 | assert(i); | ||
140 | |||
141 | - free(i->path); | ||
142 | - free(i->argument); | ||
143 | free(i); | ||
144 | } | ||
145 | |||
146 | @@ -906,7 +903,7 @@ | ||
147 | |||
148 | static int parse_line(const char *fname, unsigned line, const char *buffer) { | ||
149 | Item *i, *existing; | ||
150 | - char *mode = NULL, *user = NULL, *group = NULL, *age = NULL; | ||
151 | + char mode[50], user[50], group[50], age[50]; | ||
152 | char type; | ||
153 | Hashmap *h; | ||
154 | int r, n = -1; | ||
155 | @@ -923,18 +920,18 @@ | ||
156 | |||
157 | if (sscanf(buffer, | ||
158 | "%c " | ||
159 | - "%ms " | ||
160 | - "%ms " | ||
161 | - "%ms " | ||
162 | - "%ms " | ||
163 | - "%ms " | ||
164 | + "%s " | ||
165 | + "%s " | ||
166 | + "%s " | ||
167 | + "%s " | ||
168 | + "%s " | ||
169 | "%n", | ||
170 | &type, | ||
171 | &i->path, | ||
172 | - &mode, | ||
173 | - &user, | ||
174 | - &group, | ||
175 | - &age, | ||
176 | + mode, | ||
177 | + user, | ||
178 | + group, | ||
179 | + age, | ||
180 | &n) < 2) { | ||
181 | log_error("[%s:%u] Syntax error.", fname, line); | ||
182 | r = -EIO; | ||
183 | @@ -1096,11 +1093,6 @@ | ||
184 | r = 0; | ||
185 | |||
186 | finish: | ||
187 | - free(user); | ||
188 | - free(group); | ||
189 | - free(mode); | ||
190 | - free(age); | ||
191 | - | ||
192 | if (i) | ||
193 | item_free(i); | ||
194 | |||
195 | Index: git/src/mount.c | ||
196 | =================================================================== | ||
197 | --- git.orig/src/mount.c 2012-01-25 21:27:23.000000000 -0800 | ||
198 | +++ git/src/mount.c 2012-01-25 21:59:43.901031505 -0800 | ||
199 | @@ -24,6 +24,7 @@ | ||
200 | #include <mntent.h> | ||
201 | #include <sys/epoll.h> | ||
202 | #include <signal.h> | ||
203 | +#include <string.h> | ||
204 | |||
205 | #include "unit.h" | ||
206 | #include "mount.h" | ||
207 | @@ -1561,7 +1562,13 @@ | ||
208 | static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) { | ||
209 | int r = 0; | ||
210 | unsigned i; | ||
211 | - char *device, *path, *options, *options2, *fstype, *d, *p, *o; | ||
212 | + char *d, *p, *o; | ||
213 | + char device[50]; | ||
214 | + char path[50]; | ||
215 | + char options[50]; | ||
216 | + char options2[50]; | ||
217 | + char fstype[50]; | ||
218 | + | ||
219 | |||
220 | assert(m); | ||
221 | |||
222 | @@ -1570,26 +1577,26 @@ | ||
223 | for (i = 1;; i++) { | ||
224 | int k; | ||
225 | |||
226 | - device = path = options = options2 = fstype = d = p = o = NULL; | ||
227 | + d = p = o = NULL; | ||
228 | |||
229 | if ((k = fscanf(m->proc_self_mountinfo, | ||
230 | "%*s " /* (1) mount id */ | ||
231 | "%*s " /* (2) parent id */ | ||
232 | "%*s " /* (3) major:minor */ | ||
233 | "%*s " /* (4) root */ | ||
234 | - "%ms " /* (5) mount point */ | ||
235 | - "%ms" /* (6) mount options */ | ||
236 | + "%49s " /* (5) mount point */ | ||
237 | + "%49s" /* (6) mount options */ | ||
238 | "%*[^-]" /* (7) optional fields */ | ||
239 | "- " /* (8) separator */ | ||
240 | - "%ms " /* (9) file system type */ | ||
241 | - "%ms" /* (10) mount source */ | ||
242 | - "%ms" /* (11) mount options 2 */ | ||
243 | + "%49s " /* (9) file system type */ | ||
244 | + "%49s" /* (10) mount source */ | ||
245 | + "%49s" /* (11) mount options 2 */ | ||
246 | "%*[^\n]", /* some rubbish at the end */ | ||
247 | - &path, | ||
248 | - &options, | ||
249 | - &fstype, | ||
250 | - &device, | ||
251 | - &options2)) != 5) { | ||
252 | + path, | ||
253 | + options, | ||
254 | + fstype, | ||
255 | + device, | ||
256 | + options2)) != 5) { | ||
257 | |||
258 | if (k == EOF) | ||
259 | break; | ||
260 | @@ -1613,22 +1620,12 @@ | ||
261 | r = k; | ||
262 | |||
263 | clean_up: | ||
264 | - free(device); | ||
265 | - free(path); | ||
266 | - free(options); | ||
267 | - free(options2); | ||
268 | - free(fstype); | ||
269 | free(d); | ||
270 | free(p); | ||
271 | free(o); | ||
272 | } | ||
273 | |||
274 | finish: | ||
275 | - free(device); | ||
276 | - free(path); | ||
277 | - free(options); | ||
278 | - free(options2); | ||
279 | - free(fstype); | ||
280 | free(d); | ||
281 | free(p); | ||
282 | free(o); | ||
283 | Index: git/src/umount.c | ||
284 | =================================================================== | ||
285 | --- git.orig/src/umount.c 2012-01-25 21:27:23.000000000 -0800 | ||
286 | +++ git/src/umount.c 2012-01-25 21:59:43.901031505 -0800 | ||
287 | @@ -60,7 +60,9 @@ | ||
288 | |||
289 | static int mount_points_list_get(MountPoint **head) { | ||
290 | FILE *proc_self_mountinfo; | ||
291 | - char *path, *p; | ||
292 | + char *p; | ||
293 | + char path[50]; | ||
294 | + | ||
295 | unsigned int i; | ||
296 | int r; | ||
297 | |||
298 | @@ -72,17 +74,17 @@ | ||
299 | for (i = 1;; i++) { | ||
300 | int k; | ||
301 | MountPoint *m; | ||
302 | - char *root; | ||
303 | + char root[50]; | ||
304 | bool skip_ro; | ||
305 | |||
306 | - path = p = NULL; | ||
307 | + p = NULL; | ||
308 | |||
309 | if ((k = fscanf(proc_self_mountinfo, | ||
310 | "%*s " /* (1) mount id */ | ||
311 | "%*s " /* (2) parent id */ | ||
312 | "%*s " /* (3) major:minor */ | ||
313 | - "%ms " /* (4) root */ | ||
314 | - "%ms " /* (5) mount point */ | ||
315 | + "%49s " /* (4) root */ | ||
316 | + "%49s " /* (5) mount point */ | ||
317 | "%*s" /* (6) mount options */ | ||
318 | "%*[^-]" /* (7) optional fields */ | ||
319 | "- " /* (8) separator */ | ||
320 | @@ -90,24 +92,21 @@ | ||
321 | "%*s" /* (10) mount source */ | ||
322 | "%*s" /* (11) mount options 2 */ | ||
323 | "%*[^\n]", /* some rubbish at the end */ | ||
324 | - &root, | ||
325 | - &path)) != 2) { | ||
326 | + root, | ||
327 | + path)) != 2) { | ||
328 | if (k == EOF) | ||
329 | break; | ||
330 | |||
331 | log_warning("Failed to parse /proc/self/mountinfo:%u.", i); | ||
332 | |||
333 | - free(path); | ||
334 | continue; | ||
335 | } | ||
336 | |||
337 | /* If we encounter a bind mount, don't try to remount | ||
338 | * the source dir too early */ | ||
339 | skip_ro = !streq(root, "/"); | ||
340 | - free(root); | ||
341 | |||
342 | p = cunescape(path); | ||
343 | - free(path); | ||
344 | |||
345 | if (!p) { | ||
346 | r = -ENOMEM; | ||
347 | @@ -152,28 +151,28 @@ | ||
348 | |||
349 | for (i = 2;; i++) { | ||
350 | MountPoint *swap; | ||
351 | - char *dev = NULL, *d; | ||
352 | + char *d; | ||
353 | + char dev[50]; | ||
354 | + | ||
355 | int k; | ||
356 | |||
357 | if ((k = fscanf(proc_swaps, | ||
358 | - "%ms " /* device/file */ | ||
359 | + "%50s " /* device/file */ | ||
360 | "%*s " /* type of swap */ | ||
361 | "%*s " /* swap size */ | ||
362 | "%*s " /* used */ | ||
363 | "%*s\n", /* priority */ | ||
364 | - &dev)) != 1) { | ||
365 | + dev)) != 1) { | ||
366 | |||
367 | if (k == EOF) | ||
368 | break; | ||
369 | |||
370 | log_warning("Failed to parse /proc/swaps:%u.", i); | ||
371 | |||
372 | - free(dev); | ||
373 | continue; | ||
374 | } | ||
375 | |||
376 | if (endswith(dev, "(deleted)")) { | ||
377 | - free(dev); | ||
378 | continue; | ||
379 | } | ||
380 | |||
diff --git a/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch b/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch new file mode 100644 index 000000000..ca10440a8 --- /dev/null +++ b/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch | |||
@@ -0,0 +1,19 @@ | |||
1 | uclibc does not have mkostemp() so we redefine it to use mkstemp() | ||
2 | |||
3 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
4 | |||
5 | Index: git/src/macro.h | ||
6 | =================================================================== | ||
7 | --- git.orig/src/macro.h 2011-06-30 10:33:53.000000000 -0700 | ||
8 | +++ git/src/macro.h 2011-06-30 15:07:28.285270006 -0700 | ||
9 | @@ -27,6 +27,10 @@ | ||
10 | #include <sys/uio.h> | ||
11 | #include <inttypes.h> | ||
12 | |||
13 | +#ifdef __UCLIBC__ | ||
14 | +/* uclibc does not implement mkostemp GNU extention */ | ||
15 | +#define mkostemp(x,y) mkstemp(x) | ||
16 | +#endif | ||
17 | #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b))) | ||
18 | #define _sentinel_ __attribute__ ((sentinel)) | ||
19 | #define _noreturn_ __attribute__((noreturn)) | ||