summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-core/systemd
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2011-07-12 01:26:15 +0000
committerKoen Kooi <koen@dominion.thruhere.net>2011-07-11 20:19:12 +0200
commit7254205d68c9321d7a7073a74a77f46c17a98b27 (patch)
treeda30e79fed267858c476930f6026bdc4ae3658e2 /meta-oe/recipes-core/systemd
parent7eaa5bd1322f1d5005f3e3ca9db2273d6548df4d (diff)
downloadmeta-openembedded-7254205d68c9321d7a7073a74a77f46c17a98b27.tar.gz
systemd: Replace use of %m in printf formats
The patch is applied optionally only to uclibc builds Also move the mkostemp replacement patch to uclibc only list Not perfect yet but gets us going on uclibc Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-core/systemd')
-rw-r--r--meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch402
-rw-r--r--meta-oe/recipes-core/systemd/systemd_git.bb8
2 files changed, 408 insertions, 2 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..3b9ed31d7
--- /dev/null
+++ b/meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch
@@ -0,0 +1,402 @@
1Patch from Henning. %m is a glibc only thing. For uclibc we need to do it
2differently. So we use static strings instead of mallocing them and free'ing
3
4I dont know if upstream systemd have plans to make systemd work on non
5glibc system libraries if not then this patch would not make sense for
6upstream
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10Index: git/src/mount-setup.c
11===================================================================
12--- git.orig/src/mount-setup.c 2011-07-03 08:24:43.892018457 -0700
13+++ git/src/mount-setup.c 2011-07-03 08:35:23.592956700 -0700
14@@ -147,10 +147,11 @@
15
16 for (;;) {
17 MountPoint p;
18- char *controller, *where;
19+ char controller[30];
20+ char *where;
21 int enabled = false;
22
23- if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) {
24+ if (fscanf(f, "%29s %*i %*i %i", controller, &enabled) != 2) {
25
26 if (feof(f))
27 break;
28@@ -161,12 +162,10 @@
29 }
30
31 if (!enabled) {
32- free(controller);
33 continue;
34 }
35
36 if (asprintf(&where, "/sys/fs/cgroup/%s", controller) < 0) {
37- free(controller);
38 r = -ENOMEM;
39 goto finish;
40 }
41@@ -180,7 +179,6 @@
42 p.fatal = false;
43
44 r = mount_one(&p);
45- free(controller);
46 free(where);
47
48 if (r < 0)
49Index: git/src/socket-util.c
50===================================================================
51--- git.orig/src/socket-util.c 2011-07-03 08:24:43.892018457 -0700
52+++ git/src/socket-util.c 2011-07-03 08:25:38.242098176 -0700
53@@ -192,7 +192,7 @@
54 int socket_address_parse_netlink(SocketAddress *a, const char *s) {
55 int family;
56 unsigned group = 0;
57- char* sfamily = NULL;
58+ char sfamily[50];
59 assert(a);
60 assert(s);
61
62@@ -200,17 +200,14 @@
63 a->type = SOCK_RAW;
64
65 errno = 0;
66- if (sscanf(s, "%ms %u", &sfamily, &group) < 1)
67+ if (sscanf(s, "%49s %u", &sfamily, &group) < 1)
68 return errno ? -errno : -EINVAL;
69
70 if ((family = netlink_family_from_string(sfamily)) < 0)
71 if (safe_atoi(sfamily, &family) < 0) {
72- free(sfamily);
73 return -EINVAL;
74 }
75
76- free(sfamily);
77-
78 a->sockaddr.nl.nl_family = AF_NETLINK;
79 a->sockaddr.nl.nl_groups = group;
80
81Index: git/src/cryptsetup-generator.c
82===================================================================
83--- git.orig/src/cryptsetup-generator.c 2011-07-03 08:24:43.892018457 -0700
84+++ git/src/cryptsetup-generator.c 2011-07-03 08:25:38.252098188 -0700
85@@ -260,7 +260,7 @@
86
87 for (;;) {
88 char line[LINE_MAX], *l;
89- char *name = NULL, *device = NULL, *password = NULL, *options = NULL;
90+ char name[50], device[50], password[50], options[50] = NULL;
91 int k;
92
93 if (!(fgets(line, sizeof(line), f)))
94@@ -272,7 +272,7 @@
95 if (*l == '#' || *l == 0)
96 continue;
97
98- if ((k = sscanf(l, "%ms %ms %ms %ms", &name, &device, &password, &options)) < 2 || k > 4) {
99+ if ((k = sscanf(l, "%s %s %s %s", &name, &device, &password, &options)) < 2 || k > 4) {
100 log_error("Failed to parse /etc/crypttab:%u, ignoring.", n);
101 r = EXIT_FAILURE;
102 goto next;
103@@ -281,11 +281,7 @@
104 if (create_disk(name, device, password, options) < 0)
105 r = EXIT_FAILURE;
106
107- next:
108- free(name);
109- free(device);
110- free(password);
111- free(options);
112+ next:;
113 }
114
115 finish:
116Index: git/src/swap.c
117===================================================================
118--- git.orig/src/swap.c 2011-07-03 08:24:43.892018457 -0700
119+++ git/src/swap.c 2011-07-03 08:34:20.512864178 -0700
120@@ -1043,11 +1043,12 @@
121 (void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n");
122
123 for (i = 1;; i++) {
124- char *dev = NULL, *d;
125+ char *d;
126+ char dev[20];
127 int prio = 0, k;
128
129 if ((k = fscanf(m->proc_swaps,
130- "%ms " /* device/file */
131+ "%19s " /* device/file */
132 "%*s " /* type of swap */
133 "%*s " /* swap size */
134 "%*s " /* used */
135@@ -1058,12 +1059,10 @@
136 break;
137
138 log_warning("Failed to parse /proc/swaps:%u.", i);
139- free(dev);
140 continue;
141 }
142
143 d = cunescape(dev);
144- free(dev);
145
146 if (!d)
147 return -ENOMEM;
148Index: git/src/tmpfiles.c
149===================================================================
150--- git.orig/src/tmpfiles.c 2011-07-03 08:24:43.892018457 -0700
151+++ git/src/tmpfiles.c 2011-07-03 08:25:38.272098222 -0700
152@@ -66,7 +66,7 @@
153 typedef struct Item {
154 char type;
155
156- char *path;
157+ char path[50];
158 uid_t uid;
159 gid_t gid;
160 mode_t mode;
161@@ -619,7 +619,6 @@
162 static void item_free(Item *i) {
163 assert(i);
164
165- free(i->path);
166 free(i);
167 }
168
169@@ -654,7 +653,7 @@
170
171 static int parse_line(const char *fname, unsigned line, const char *buffer) {
172 Item *i, *existing;
173- char *mode = NULL, *user = NULL, *group = NULL, *age = NULL;
174+ char mode[50], user[50], group[50], age[50];
175 Hashmap *h;
176 int r;
177
178@@ -669,17 +668,17 @@
179
180 if (sscanf(buffer,
181 "%c "
182- "%ms "
183- "%ms "
184- "%ms "
185- "%ms "
186- "%ms",
187+ "%s "
188+ "%s "
189+ "%s "
190+ "%s "
191+ "%s",
192 &i->type,
193 &i->path,
194- &mode,
195- &user,
196- &group,
197- &age) < 2) {
198+ mode,
199+ user,
200+ group,
201+ age) < 2) {
202 log_error("[%s:%u] Syntax error.", fname, line);
203 r = -EIO;
204 goto finish;
205@@ -793,11 +792,6 @@
206 r = 0;
207
208 finish:
209- free(user);
210- free(group);
211- free(mode);
212- free(age);
213-
214 if (i)
215 item_free(i);
216
217Index: git/src/mount.c
218===================================================================
219--- git.orig/src/mount.c 2011-07-03 08:24:43.892018457 -0700
220+++ git/src/mount.c 2011-07-03 08:33:43.112809328 -0700
221@@ -24,6 +24,7 @@
222 #include <mntent.h>
223 #include <sys/epoll.h>
224 #include <signal.h>
225+#include <string.h>
226
227 #include "unit.h"
228 #include "mount.h"
229@@ -1555,7 +1556,13 @@
230 static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
231 int r = 0;
232 unsigned i;
233- char *device, *path, *options, *options2, *fstype, *d, *p, *o;
234+ char *d, *p, *o;
235+ char device[50];
236+ char path[50];
237+ char options[50];
238+ char options2[50];
239+ char fstype[50];
240+
241
242 assert(m);
243
244@@ -1564,26 +1571,26 @@
245 for (i = 1;; i++) {
246 int k;
247
248- device = path = options = options2 = fstype = d = p = o = NULL;
249+ d = p = o = NULL;
250
251 if ((k = fscanf(m->proc_self_mountinfo,
252 "%*s " /* (1) mount id */
253 "%*s " /* (2) parent id */
254 "%*s " /* (3) major:minor */
255 "%*s " /* (4) root */
256- "%ms " /* (5) mount point */
257- "%ms" /* (6) mount options */
258+ "%49s " /* (5) mount point */
259+ "%49s" /* (6) mount options */
260 "%*[^-]" /* (7) optional fields */
261 "- " /* (8) separator */
262- "%ms " /* (9) file system type */
263- "%ms" /* (10) mount source */
264- "%ms" /* (11) mount options 2 */
265+ "%49s " /* (9) file system type */
266+ "%49s" /* (10) mount source */
267+ "%49s" /* (11) mount options 2 */
268 "%*[^\n]", /* some rubbish at the end */
269- &path,
270- &options,
271- &fstype,
272- &device,
273- &options2)) != 5) {
274+ path,
275+ options,
276+ fstype,
277+ device,
278+ options2)) != 5) {
279
280 if (k == EOF)
281 break;
282@@ -1607,22 +1614,12 @@
283 r = k;
284
285 clean_up:
286- free(device);
287- free(path);
288- free(options);
289- free(options2);
290- free(fstype);
291 free(d);
292 free(p);
293 free(o);
294 }
295
296 finish:
297- free(device);
298- free(path);
299- free(options);
300- free(options2);
301- free(fstype);
302 free(d);
303 free(p);
304 free(o);
305Index: git/src/umount.c
306===================================================================
307--- git.orig/src/umount.c 2011-07-03 08:24:43.892018457 -0700
308+++ git/src/umount.c 2011-07-03 08:33:06.732755969 -0700
309@@ -60,7 +60,9 @@
310
311 static int mount_points_list_get(MountPoint **head) {
312 FILE *proc_self_mountinfo;
313- char *path, *p;
314+ char *p;
315+ char path[50];
316+
317 unsigned int i;
318 int r;
319
320@@ -72,17 +74,17 @@
321 for (i = 1;; i++) {
322 int k;
323 MountPoint *m;
324- char *root;
325+ char root[50];
326 bool skip_ro;
327
328- path = p = NULL;
329+ p = NULL;
330
331 if ((k = fscanf(proc_self_mountinfo,
332 "%*s " /* (1) mount id */
333 "%*s " /* (2) parent id */
334 "%*s " /* (3) major:minor */
335- "%ms " /* (4) root */
336- "%ms " /* (5) mount point */
337+ "%49s " /* (4) root */
338+ "%49s " /* (5) mount point */
339 "%*s" /* (6) mount options */
340 "%*[^-]" /* (7) optional fields */
341 "- " /* (8) separator */
342@@ -90,24 +92,21 @@
343 "%*s" /* (10) mount source */
344 "%*s" /* (11) mount options 2 */
345 "%*[^\n]", /* some rubbish at the end */
346- &root,
347- &path)) != 2) {
348+ root,
349+ path)) != 2) {
350 if (k == EOF)
351 break;
352
353 log_warning("Failed to parse /proc/self/mountinfo:%u.", i);
354
355- free(path);
356 continue;
357 }
358
359 /* If we encounter a bind mount, don't try to remount
360 * the source dir too early */
361 skip_ro = !streq(root, "/");
362- free(root);
363
364 p = cunescape(path);
365- free(path);
366
367 if (!p) {
368 r = -ENOMEM;
369@@ -152,28 +151,28 @@
370
371 for (i = 2;; i++) {
372 MountPoint *swap;
373- char *dev = NULL, *d;
374+ char *d;
375+ char dev[50];
376+
377 int k;
378
379 if ((k = fscanf(proc_swaps,
380- "%ms " /* device/file */
381+ "%50s " /* device/file */
382 "%*s " /* type of swap */
383 "%*s " /* swap size */
384 "%*s " /* used */
385 "%*s\n", /* priority */
386- &dev)) != 1) {
387+ dev)) != 1) {
388
389 if (k == EOF)
390 break;
391
392 log_warning("Failed to parse /proc/swaps:%u.", i);
393
394- free(dev);
395 continue;
396 }
397
398 if (endswith(dev, "(deleted)")) {
399- free(dev);
400 continue;
401 }
402
diff --git a/meta-oe/recipes-core/systemd/systemd_git.bb b/meta-oe/recipes-core/systemd/systemd_git.bb
index 66cc831f0..ebb8e7f84 100644
--- a/meta-oe/recipes-core/systemd/systemd_git.bb
+++ b/meta-oe/recipes-core/systemd/systemd_git.bb
@@ -15,7 +15,7 @@ inherit gitpkgv
15PKGV = "v${GITPKGVTAG}" 15PKGV = "v${GITPKGVTAG}"
16 16
17PV = "git" 17PV = "git"
18PR = "r7" 18PR = "r8"
19 19
20inherit autotools vala 20inherit autotools vala
21 21
@@ -23,9 +23,13 @@ SRCREV = "ef3a24de028efe885db1303b4843aba5ffd0f531"
23 23
24SRC_URI = "git://anongit.freedesktop.org/systemd;protocol=git \ 24SRC_URI = "git://anongit.freedesktop.org/systemd;protocol=git \
25 file://0001-systemd-disable-xml-file-stuff-and-introspection.patch \ 25 file://0001-systemd-disable-xml-file-stuff-and-introspection.patch \
26 file://paper-over-mkostemp.patch \
27 file://use-nonet-for-docbook.patch \ 26 file://use-nonet-for-docbook.patch \
27 ${UCLIBCPATCHES} \
28 " 28 "
29UCLIBCPATCHES = ""
30UCLIBCPATCHES_libc-uclibc = "file://paper-over-mkostemp.patch \
31 file://format-replace-m-uclibc.patch \
32 "
29 33
30S = "${WORKDIR}/git" 34S = "${WORKDIR}/git"
31 35