diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-05-13 18:30:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-05-13 18:30:14 +0200 |
commit | cbf60d0a7fda7bd6c0578a6cc151f798a0edfd02 (patch) | |
tree | 2dfa9ac6f8f0501354c4d9a272dc49dc91357e4c /src/core/busname.c | |
parent | b4a855e9f6a4d09c18772aa797dc7d606d163b88 (diff) | |
download | systemd-cbf60d0a7fda7bd6c0578a6cc151f798a0edfd02.tar.gz |
core: only set event source name when we create an event source
Diffstat (limited to 'src/core/busname.c')
-rw-r--r-- | src/core/busname.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/core/busname.c b/src/core/busname.c index eb95c8e81e..17b85134e8 100644 --- a/src/core/busname.c +++ b/src/core/busname.c @@ -287,20 +287,24 @@ static int busname_watch_fd(BusName *n) { if (n->starter_fd < 0) return 0; - if (n->starter_event_source) + if (n->starter_event_source) { r = sd_event_source_set_enabled(n->starter_event_source, SD_EVENT_ON); - else + if (r < 0) + goto fail; + } else { r = sd_event_add_io(UNIT(n)->manager->event, &n->starter_event_source, n->starter_fd, EPOLLIN, busname_dispatch_io, n); + if (r < 0) + goto fail; - if (r < 0) { - log_unit_warning_errno(UNIT(n), r, "Failed to watch starter fd: %m"); - busname_unwatch_fd(n); - return r; + (void) sd_event_source_set_description(n->starter_event_source, "busname-starter"); } - (void) sd_event_source_set_description(n->starter_event_source, "busname-starter"); - return 0; + +fail: + log_unit_warning_errno(UNIT(n), r, "Failed to watch starter fd: %m"); + busname_unwatch_fd(n); + return r; } static int busname_open_fd(BusName *n) { |