summaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-05-13 18:30:14 +0200
committerLennart Poettering <lennart@poettering.net>2015-05-13 18:30:14 +0200
commitcbf60d0a7fda7bd6c0578a6cc151f798a0edfd02 (patch)
tree2dfa9ac6f8f0501354c4d9a272dc49dc91357e4c /src/core/socket.c
parentb4a855e9f6a4d09c18772aa797dc7d606d163b88 (diff)
core: only set event source name when we create an event source
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index a655ec9d58..17b8a5059d 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1268,22 +1268,23 @@ static int socket_watch_fds(Socket *s) {
if (p->fd < 0)
continue;
- if (p->event_source)
+ if (p->event_source) {
r = sd_event_source_set_enabled(p->event_source, SD_EVENT_ON);
- else
+ if (r < 0)
+ goto fail;
+ } else {
r = sd_event_add_io(UNIT(s)->manager->event, &p->event_source, p->fd, EPOLLIN, socket_dispatch_io, p);
+ if (r < 0)
+ goto fail;
- if (r < 0) {
- log_unit_warning_errno(UNIT(s), r, "Failed to watch listening fds: %m");
- goto fail;
+ (void) sd_event_source_set_description(p->event_source, "socket-port-io");
}
-
- (void) sd_event_source_set_description(p->event_source, "socket-port-io");
}
return 0;
fail:
+ log_unit_warning_errno(UNIT(s), r, "Failed to watch listening fds: %m");
socket_unwatch_fds(s);
return r;
}