diff options
author | Thomas Haller <thaller@redhat.com> | 2015-09-22 13:26:58 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-09-23 15:40:35 +0200 |
commit | 3793a2bf795b68246f69b32b4a360fde73f82d79 (patch) | |
tree | 0e580cc112b984161f5e920ae14f39f52eba8a36 | |
parent | a331cf39804fa2f1f47148a82621aedabc87d939 (diff) | |
download | NetworkManager-3793a2bf795b68246f69b32b4a360fde73f82d79.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.c | 8 |
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; |