summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-09-22 13:26:58 +0200
committerThomas Haller <thaller@redhat.com>2015-09-23 16:09:43 +0200
commit02c51d4231da154b624fe5859a1e34f340eecb05 (patch)
treef1a3b4cce70d9e61eeb2b08aa91430bb2617ff03
parent9901047ae3464999ab5c52ac408f603c73239597 (diff)
downloadNetworkManager-02c51d4231da154b624fe5859a1e34f340eecb05.tar.gz
systemd/adapt: assert that a @source argument is passed to sd_event_add_time()
Systemd supports omitting the output source argument. In this case, the created event source is floating and the reference count is handled properly. We have however no callers that make use of that functionality, so instead of implementing floating references, assert that we don't need it. This isn't a change in behavior, because previously the could would just SEGFAULT if a caller didn't want to take ownership of the created event.
-rw-r--r--src/systemd/nm-sd-adapt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/systemd/nm-sd-adapt.c b/src/systemd/nm-sd-adapt.c
index 67ddc8da1b..1f8f2dcc3e 100644
--- a/src/systemd/nm-sd-adapt.c
+++ b/src/systemd/nm-sd-adapt.c
@@ -125,6 +125,10 @@ sd_event_add_io (sd_event *e, sd_event_source **s, int fd, uint32_t events, sd_e
GIOChannel *channel;
GIOCondition condition = 0;
+ /* systemd supports floating sd_event_source by omitting the @s argument.
+ * We don't have such users and don't implement floating references. */
+ g_return_val_if_fail (s, -EINVAL);
+
channel = g_io_channel_unix_new (fd);
if (!channel)
return -EINVAL;
@@ -179,6 +183,10 @@ sd_event_add_time(sd_event *e, sd_event_source **s, clockid_t clock, uint64_t us
struct sd_event_source *source;
uint64_t n = now (clock);
+ /* systemd supports floating sd_event_source by omitting the @s argument.
+ * We don't have such users and don't implement floating references. */
+ g_return_val_if_fail (s, -EINVAL);
+
source = source_new ();
source->time_cb = callback;
source->user_data = userdata;