mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 19:10:17 +01:00
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.
This commit is contained in:
parent
9901047ae3
commit
02c51d4231
1 changed files with 8 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue