diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-04 16:58:42 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-04 18:09:19 +0100 |
commit | f4b2933ee7890e5d414ab266d8586f19027a2bd9 (patch) | |
tree | 87d49a134602d8237fd426627989fa7822f664da /src/libsystemd/sd-event | |
parent | d1b91c99d9241f7f79756a42f845cf35992888cd (diff) |
sd-bus,sd-event: unify error handling of object descriptions
a) When getting the description return ENXIO if none is set
b) Allow setting a description to NULL
c) return ECHILD on fork() like for other calls
Diffstat (limited to 'src/libsystemd/sd-event')
-rw-r--r-- | src/libsystemd/sd-event/sd-event.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index e856d68251..fb436adc13 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -1258,6 +1258,7 @@ _public_ sd_event_source* sd_event_source_unref(sd_event_source *s) { _public_ int sd_event_source_set_description(sd_event_source *s, const char *description) { assert_return(s, -EINVAL); + assert_return(!event_pid_changed(s->event), -ECHILD); return free_and_strdup(&s->description, description); } @@ -1265,6 +1266,8 @@ _public_ int sd_event_source_set_description(sd_event_source *s, const char *des _public_ int sd_event_source_get_description(sd_event_source *s, const char **description) { assert_return(s, -EINVAL); assert_return(description, -EINVAL); + assert_return(s->description, -ENXIO); + assert_return(!event_pid_changed(s->event), -ECHILD); *description = s->description; return 0; |