summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch513
-rw-r--r--meta/recipes-core/systemd/systemd_211.bb1
2 files changed, 514 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch b/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
new file mode 100644
index 0000000000..c5bee97238
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/sd-bus-don-t-use-assert_return-to-check-for-disconne.patch
@@ -0,0 +1,513 @@
1From a3d59cd1b0a2738d06893948492113f2c35be0af Mon Sep 17 00:00:00 2001
2From: Lennart Poettering <lennart@poettering.net>
3Date: Wed, 19 Mar 2014 21:41:21 +0100
4Subject: [PATCH] sd-bus: don't use assert_return() to check for disconnected
5 bus connections
6
7A terminated connection is a runtime error and not a developer mistake,
8hence don't use assert_return() to check for it.
9
10Upstream-Status: Backport
11
12Signed-off-by: Jonathan Liu <net147@gmail.com>
13---
14 src/libsystemd/sd-bus/bus-control.c | 20 +++++++++---
15 src/libsystemd/sd-bus/bus-convenience.c | 58 +++++++++++++++++++++++++--------
16 src/libsystemd/sd-bus/bus-objects.c | 23 +++++++++----
17 src/libsystemd/sd-bus/sd-bus.c | 49 ++++++++++++++++++++--------
18 4 files changed, 113 insertions(+), 37 deletions(-)
19
20diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
21index bb6683e..bd392a2 100644
22--- a/src/libsystemd/sd-bus/bus-control.c
23+++ b/src/libsystemd/sd-bus/bus-control.c
24@@ -128,12 +128,14 @@ _public_ int sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags)
25 assert_return(bus, -EINVAL);
26 assert_return(name, -EINVAL);
27 assert_return(bus->bus_client, -EINVAL);
28- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
29 assert_return(!bus_pid_changed(bus), -ECHILD);
30 assert_return(!(flags & ~(SD_BUS_NAME_ALLOW_REPLACEMENT|SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_QUEUE)), -EINVAL);
31 assert_return(service_name_is_valid(name), -EINVAL);
32 assert_return(name[0] != ':', -EINVAL);
33
34+ if (!BUS_IS_OPEN(bus->state))
35+ return -ENOTCONN;
36+
37 if (bus->is_kernel)
38 return bus_request_name_kernel(bus, name, flags);
39 else
40@@ -201,11 +203,13 @@ _public_ int sd_bus_release_name(sd_bus *bus, const char *name) {
41 assert_return(bus, -EINVAL);
42 assert_return(name, -EINVAL);
43 assert_return(bus->bus_client, -EINVAL);
44- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
45 assert_return(!bus_pid_changed(bus), -ECHILD);
46 assert_return(service_name_is_valid(name), -EINVAL);
47 assert_return(name[0] != ':', -EINVAL);
48
49+ if (!BUS_IS_OPEN(bus->state))
50+ return -ENOTCONN;
51+
52 if (bus->is_kernel)
53 return bus_release_name_kernel(bus, name);
54 else
55@@ -342,9 +346,11 @@ static int bus_list_names_dbus1(sd_bus *bus, char ***acquired, char ***activatab
56 _public_ int sd_bus_list_names(sd_bus *bus, char ***acquired, char ***activatable) {
57 assert_return(bus, -EINVAL);
58 assert_return(acquired || activatable, -EINVAL);
59- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
60 assert_return(!bus_pid_changed(bus), -ECHILD);
61
62+ if (!BUS_IS_OPEN(bus->state))
63+ return -ENOTCONN;
64+
65 if (bus->is_kernel)
66 return bus_list_names_kernel(bus, acquired, activatable);
67 else
68@@ -735,11 +741,13 @@ _public_ int sd_bus_get_owner(
69 assert_return(name, -EINVAL);
70 assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP);
71 assert_return(mask == 0 || creds, -EINVAL);
72- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
73 assert_return(!bus_pid_changed(bus), -ECHILD);
74 assert_return(service_name_is_valid(name), -EINVAL);
75 assert_return(bus->bus_client, -ENODATA);
76
77+ if (!BUS_IS_OPEN(bus->state))
78+ return -ENOTCONN;
79+
80 if (bus->is_kernel)
81 return bus_get_owner_kdbus(bus, name, mask, creds);
82 else
83@@ -1196,10 +1204,12 @@ _public_ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128
84 assert_return(bus, -EINVAL);
85 assert_return(name, -EINVAL);
86 assert_return(machine, -EINVAL);
87- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
88 assert_return(!bus_pid_changed(bus), -ECHILD);
89 assert_return(service_name_is_valid(name), -EINVAL);
90
91+ if (!BUS_IS_OPEN(bus->state))
92+ return -ENOTCONN;
93+
94 if (streq_ptr(name, bus->unique_name))
95 return sd_id128_get_machine(machine);
96
97diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c
98index 6e02ad3..c5b9cd4 100644
99--- a/src/libsystemd/sd-bus/bus-convenience.c
100+++ b/src/libsystemd/sd-bus/bus-convenience.c
101@@ -36,9 +36,11 @@ _public_ int sd_bus_emit_signal(
102 int r;
103
104 assert_return(bus, -EINVAL);
105- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
106 assert_return(!bus_pid_changed(bus), -ECHILD);
107
108+ if (!BUS_IS_OPEN(bus->state))
109+ return -ENOTCONN;
110+
111 r = sd_bus_message_new_signal(bus, &m, path, interface, member);
112 if (r < 0)
113 return r;
114@@ -70,9 +72,11 @@ _public_ int sd_bus_call_method(
115 int r;
116
117 assert_return(bus, -EINVAL);
118- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
119 assert_return(!bus_pid_changed(bus), -ECHILD);
120
121+ if (!BUS_IS_OPEN(bus->state))
122+ return -ENOTCONN;
123+
124 r = sd_bus_message_new_method_call(bus, &m, destination, path, interface, member);
125 if (r < 0)
126 return r;
127@@ -100,9 +104,12 @@ _public_ int sd_bus_reply_method_return(
128 assert_return(call, -EINVAL);
129 assert_return(call->sealed, -EPERM);
130 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
131- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
132+ assert_return(call->bus, -EINVAL);
133 assert_return(!bus_pid_changed(call->bus), -ECHILD);
134
135+ if (!BUS_IS_OPEN(call->bus->state))
136+ return -ENOTCONN;
137+
138 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
139 return 0;
140
141@@ -134,9 +141,12 @@ _public_ int sd_bus_reply_method_error(
142 assert_return(call->sealed, -EPERM);
143 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
144 assert_return(sd_bus_error_is_set(e), -EINVAL);
145- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
146+ assert_return(call->bus, -EINVAL);
147 assert_return(!bus_pid_changed(call->bus), -ECHILD);
148
149+ if (!BUS_IS_OPEN(call->bus->state))
150+ return -ENOTCONN;
151+
152 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
153 return 0;
154
155@@ -159,9 +169,12 @@ _public_ int sd_bus_reply_method_errorf(
156 assert_return(call, -EINVAL);
157 assert_return(call->sealed, -EPERM);
158 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
159- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
160+ assert_return(call->bus, -EINVAL);
161 assert_return(!bus_pid_changed(call->bus), -ECHILD);
162
163+ if (!BUS_IS_OPEN(call->bus->state))
164+ return -ENOTCONN;
165+
166 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
167 return 0;
168
169@@ -182,9 +195,12 @@ _public_ int sd_bus_reply_method_errno(
170 assert_return(call, -EINVAL);
171 assert_return(call->sealed, -EPERM);
172 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
173- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
174+ assert_return(call->bus, -EINVAL);
175 assert_return(!bus_pid_changed(call->bus), -ECHILD);
176
177+ if (!BUS_IS_OPEN(call->bus->state))
178+ return -ENOTCONN;
179+
180 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
181 return 0;
182
183@@ -208,9 +224,12 @@ _public_ int sd_bus_reply_method_errnof(
184 assert_return(call, -EINVAL);
185 assert_return(call->sealed, -EPERM);
186 assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
187- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
188+ assert_return(call->bus, -EINVAL);
189 assert_return(!bus_pid_changed(call->bus), -ECHILD);
190
191+ if (!BUS_IS_OPEN(call->bus->state))
192+ return -ENOTCONN;
193+
194 if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
195 return 0;
196
197@@ -239,9 +258,11 @@ _public_ int sd_bus_get_property(
198 assert_return(member_name_is_valid(member), -EINVAL);
199 assert_return(reply, -EINVAL);
200 assert_return(signature_is_single(type, false), -EINVAL);
201- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
202 assert_return(!bus_pid_changed(bus), -ECHILD);
203
204+ if (!BUS_IS_OPEN(bus->state))
205+ return -ENOTCONN;
206+
207 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member);
208 if (r < 0)
209 return r;
210@@ -273,9 +294,11 @@ _public_ int sd_bus_get_property_trivial(
211 assert_return(member_name_is_valid(member), -EINVAL);
212 assert_return(bus_type_is_trivial(type), -EINVAL);
213 assert_return(ptr, -EINVAL);
214- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
215 assert_return(!bus_pid_changed(bus), -ECHILD);
216
217+ if (!BUS_IS_OPEN(bus->state))
218+ return -ENOTCONN;
219+
220 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
221 if (r < 0)
222 return r;
223@@ -309,9 +332,11 @@ _public_ int sd_bus_get_property_string(
224 assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
225 assert_return(member_name_is_valid(member), -EINVAL);
226 assert_return(ret, -EINVAL);
227- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
228 assert_return(!bus_pid_changed(bus), -ECHILD);
229
230+ if (!BUS_IS_OPEN(bus->state))
231+ return -ENOTCONN;
232+
233 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
234 if (r < 0)
235 return r;
236@@ -348,9 +373,11 @@ _public_ int sd_bus_get_property_strv(
237 assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
238 assert_return(member_name_is_valid(member), -EINVAL);
239 assert_return(ret, -EINVAL);
240- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
241 assert_return(!bus_pid_changed(bus), -ECHILD);
242
243+ if (!BUS_IS_OPEN(bus->state))
244+ return -ENOTCONN;
245+
246 r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
247 if (r < 0)
248 return r;
249@@ -383,9 +410,11 @@ _public_ int sd_bus_set_property(
250 assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL);
251 assert_return(member_name_is_valid(member), -EINVAL);
252 assert_return(signature_is_single(type, false), -EINVAL);
253- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
254 assert_return(!bus_pid_changed(bus), -ECHILD);
255
256+ if (!BUS_IS_OPEN(bus->state))
257+ return -ENOTCONN;
258+
259 r = sd_bus_message_new_method_call(bus, &m, destination, path, "org.freedesktop.DBus.Properties", "Set");
260 if (r < 0)
261 return r;
262@@ -416,9 +445,12 @@ _public_ int sd_bus_query_sender_creds(sd_bus_message *call, uint64_t mask, sd_b
263
264 assert_return(call, -EINVAL);
265 assert_return(call->sealed, -EPERM);
266- assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN);
267+ assert_return(call->bus, -EINVAL);
268 assert_return(!bus_pid_changed(call->bus), -ECHILD);
269
270+ if (!BUS_IS_OPEN(call->bus->state))
271+ return -ENOTCONN;
272+
273 c = sd_bus_message_get_creds(call);
274
275 /* All data we need? */
276diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
277index 08792fe..539cf2a 100644
278--- a/src/libsystemd/sd-bus/bus-objects.c
279+++ b/src/libsystemd/sd-bus/bus-objects.c
280@@ -2196,9 +2196,10 @@ _public_ int sd_bus_emit_properties_changed_strv(
281 assert_return(bus, -EINVAL);
282 assert_return(object_path_is_valid(path), -EINVAL);
283 assert_return(interface_name_is_valid(interface), -EINVAL);
284- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
285 assert_return(!bus_pid_changed(bus), -ECHILD);
286
287+ if (!BUS_IS_OPEN(bus->state))
288+ return -ENOTCONN;
289
290 /* A non-NULL but empty names list means nothing needs to be
291 generated. A NULL list OTOH indicates that all properties
292@@ -2241,9 +2242,11 @@ _public_ int sd_bus_emit_properties_changed(
293 assert_return(bus, -EINVAL);
294 assert_return(object_path_is_valid(path), -EINVAL);
295 assert_return(interface_name_is_valid(interface), -EINVAL);
296- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
297 assert_return(!bus_pid_changed(bus), -ECHILD);
298
299+ if (!BUS_IS_OPEN(bus->state))
300+ return -ENOTCONN;
301+
302 if (!name)
303 return 0;
304
305@@ -2361,9 +2364,11 @@ _public_ int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, ch
306
307 assert_return(bus, -EINVAL);
308 assert_return(object_path_is_valid(path), -EINVAL);
309- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
310 assert_return(!bus_pid_changed(bus), -ECHILD);
311
312+ if (!BUS_IS_OPEN(bus->state))
313+ return -ENOTCONN;
314+
315 if (strv_isempty(interfaces))
316 return 0;
317
318@@ -2421,9 +2426,11 @@ _public_ int sd_bus_emit_interfaces_added(sd_bus *bus, const char *path, const c
319
320 assert_return(bus, -EINVAL);
321 assert_return(object_path_is_valid(path), -EINVAL);
322- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
323 assert_return(!bus_pid_changed(bus), -ECHILD);
324
325+ if (!BUS_IS_OPEN(bus->state))
326+ return -ENOTCONN;
327+
328 interfaces = strv_from_stdarg_alloca(interface);
329
330 return sd_bus_emit_interfaces_added_strv(bus, path, interfaces);
331@@ -2435,9 +2442,11 @@ _public_ int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path,
332
333 assert_return(bus, -EINVAL);
334 assert_return(object_path_is_valid(path), -EINVAL);
335- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
336 assert_return(!bus_pid_changed(bus), -ECHILD);
337
338+ if (!BUS_IS_OPEN(bus->state))
339+ return -ENOTCONN;
340+
341 if (strv_isempty(interfaces))
342 return 0;
343
344@@ -2461,9 +2470,11 @@ _public_ int sd_bus_emit_interfaces_removed(sd_bus *bus, const char *path, const
345
346 assert_return(bus, -EINVAL);
347 assert_return(object_path_is_valid(path), -EINVAL);
348- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
349 assert_return(!bus_pid_changed(bus), -ECHILD);
350
351+ if (!BUS_IS_OPEN(bus->state))
352+ return -ENOTCONN;
353+
354 interfaces = strv_from_stdarg_alloca(interface);
355
356 return sd_bus_emit_interfaces_removed_strv(bus, path, interfaces);
357diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
358index fa6d43a..15c7677 100644
359--- a/src/libsystemd/sd-bus/sd-bus.c
360+++ b/src/libsystemd/sd-bus/sd-bus.c
361@@ -1594,10 +1594,12 @@ static int bus_send_internal(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie,
362 int r;
363
364 assert_return(bus, -EINVAL);
365- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
366 assert_return(m, -EINVAL);
367 assert_return(!bus_pid_changed(bus), -ECHILD);
368
369+ if (!BUS_IS_OPEN(bus->state))
370+ return -ENOTCONN;
371+
372 if (m->n_fds > 0) {
373 r = sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD);
374 if (r < 0)
375@@ -1673,10 +1675,12 @@ _public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destinat
376 int r;
377
378 assert_return(bus, -EINVAL);
379- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
380 assert_return(m, -EINVAL);
381 assert_return(!bus_pid_changed(bus), -ECHILD);
382
383+ if (!BUS_IS_OPEN(bus->state))
384+ return -ENOTCONN;
385+
386 if (!streq_ptr(m->destination, destination)) {
387
388 if (!destination)
389@@ -1728,13 +1732,15 @@ _public_ int sd_bus_call_async(
390 int r;
391
392 assert_return(bus, -EINVAL);
393- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
394 assert_return(m, -EINVAL);
395 assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
396 assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
397 assert_return(callback, -EINVAL);
398 assert_return(!bus_pid_changed(bus), -ECHILD);
399
400+ if (!BUS_IS_OPEN(bus->state))
401+ return -ENOTCONN;
402+
403 r = hashmap_ensure_allocated(&bus->reply_callbacks, uint64_hash_func, uint64_compare_func);
404 if (r < 0)
405 return r;
406@@ -1841,13 +1847,15 @@ _public_ int sd_bus_call(
407 int r;
408
409 assert_return(bus, -EINVAL);
410- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
411 assert_return(m, -EINVAL);
412 assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
413 assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
414 assert_return(!bus_error_is_dirty(error), -EINVAL);
415 assert_return(!bus_pid_changed(bus), -ECHILD);
416
417+ if (!BUS_IS_OPEN(bus->state))
418+ return -ENOTCONN;
419+
420 r = bus_ensure_running(bus);
421 if (r < 0)
422 return r;
423@@ -1973,9 +1981,11 @@ _public_ int sd_bus_get_events(sd_bus *bus) {
424 int flags = 0;
425
426 assert_return(bus, -EINVAL);
427- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN);
428 assert_return(!bus_pid_changed(bus), -ECHILD);
429
430+ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING)
431+ return -ENOTCONN;
432+
433 if (bus->state == BUS_OPENING)
434 flags |= POLLOUT;
435 else if (bus->state == BUS_AUTHENTICATING) {
436@@ -2000,9 +2010,11 @@ _public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) {
437
438 assert_return(bus, -EINVAL);
439 assert_return(timeout_usec, -EINVAL);
440- assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN);
441 assert_return(!bus_pid_changed(bus), -ECHILD);
442
443+ if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING)
444+ return -ENOTCONN;
445+
446 if (bus->track_queue) {
447 *timeout_usec = 0;
448 return 1;
449@@ -2531,7 +2543,8 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) {
450 if (bus->state == BUS_CLOSING)
451 return 1;
452
453- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
454+ if (!BUS_IS_OPEN(bus->state))
455+ return -ENOTCONN;
456
457 e = sd_bus_get_events(bus);
458 if (e < 0)
459@@ -2586,7 +2599,8 @@ _public_ int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec) {
460 if (bus->state == BUS_CLOSING)
461 return 0;
462
463- assert_return(BUS_IS_OPEN(bus->state) , -ENOTCONN);
464+ if (!BUS_IS_OPEN(bus->state))
465+ return -ENOTCONN;
466
467 if (bus->rqueue_size > 0)
468 return 0;
469@@ -2603,7 +2617,8 @@ _public_ int sd_bus_flush(sd_bus *bus) {
470 if (bus->state == BUS_CLOSING)
471 return 0;
472
473- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
474+ if (!BUS_IS_OPEN(bus->state))
475+ return -ENOTCONN;
476
477 r = bus_ensure_running(bus);
478 if (r < 0)
479@@ -3113,9 +3128,13 @@ _public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re
480 assert_return(bus, -EINVAL);
481 assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP);
482 assert_return(ret, -EINVAL);
483- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
484 assert_return(!bus_pid_changed(bus), -ECHILD);
485- assert_return(!bus->is_kernel, -ENOTSUP);
486+
487+ if (!bus->is_kernel)
488+ return -ENOTSUP;
489+
490+ if (!BUS_IS_OPEN(bus->state))
491+ return -ENOTCONN;
492
493 if (!bus->ucred_valid && !isempty(bus->label))
494 return -ENODATA;
495@@ -3154,9 +3173,13 @@ _public_ int sd_bus_try_close(sd_bus *bus) {
496 int r;
497
498 assert_return(bus, -EINVAL);
499- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
500 assert_return(!bus_pid_changed(bus), -ECHILD);
501- assert_return(bus->is_kernel, -ENOTSUP);
502+
503+ if (!bus->is_kernel)
504+ return -ENOTSUP;
505+
506+ if (!BUS_IS_OPEN(bus->state))
507+ return -ENOTCONN;
508
509 if (bus->rqueue_size > 0)
510 return -EBUSY;
511--
5121.9.1
513
diff --git a/meta/recipes-core/systemd/systemd_211.bb b/meta/recipes-core/systemd/systemd_211.bb
index 044aab5a00..44b196538a 100644
--- a/meta/recipes-core/systemd/systemd_211.bb
+++ b/meta/recipes-core/systemd/systemd_211.bb
@@ -31,6 +31,7 @@ SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=
31 file://0001-uClibc-doesn-t-implement-pwritev-preadv.patch \ 31 file://0001-uClibc-doesn-t-implement-pwritev-preadv.patch \
32 file://uclibc-sysinfo_h.patch \ 32 file://uclibc-sysinfo_h.patch \
33 file://uclibc-get-physmem.patch \ 33 file://uclibc-get-physmem.patch \
34 file://sd-bus-don-t-use-assert_return-to-check-for-disconne.patch \
34 \ 35 \
35 file://touchscreen.rules \ 36 file://touchscreen.rules \
36 file://00-create-volatile.conf \ 37 file://00-create-volatile.conf \