summaryrefslogtreecommitdiff
path: root/socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-16 23:24:39 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-16 23:24:39 +0200
commit8d567588cad053f79abe603ab113e1b85a92f1da (patch)
treed29f8cbd6233fac569b84774d7a72a5fd8049b29 /socket.c
parent2076ca540e4ffdd320e086c8b570a5bf19546022 (diff)
automount: implement automount unit type
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/socket.c b/socket.c
index 91832128f5..88fb2d3869 100644
--- a/socket.c
+++ b/socket.c
@@ -111,19 +111,12 @@ static void socket_init(Unit *u) {
assert(u);
assert(u->meta.load_state == UNIT_STUB);
- s->state = 0;
s->timer_watch.type = WATCH_INVALID;
- s->bind_ipv6_only = false;
s->backlog = SOMAXCONN;
s->timeout_usec = DEFAULT_TIMEOUT_USEC;
s->directory_mode = 0755;
s->socket_mode = 0666;
- s->kill_mode = 0;
- s->failure = false;
- s->control_pid = 0;
- s->service = NULL;
- s->accept = false;
- s->n_accepted = 0;
+
exec_context_init(&s->exec_context);
}
@@ -899,13 +892,13 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
int cfd = -1;
assert(s);
+ assert(fd >= 0);
log_debug("Incoming traffic on %s", u->meta.id);
if (events != EPOLLIN) {
log_error("Got invalid poll event on socket.");
- socket_enter_stop_pre(s, false);
- return;
+ goto fail;
}
if (w->data.socket_accept) {
@@ -917,8 +910,7 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
continue;
log_error("Failed to accept socket: %m");
- socket_enter_stop_pre(s, false);
- return;
+ goto fail;
}
break;
@@ -926,6 +918,10 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
}
socket_enter_running(s, cfd);
+ return;
+
+fail:
+ socket_enter_stop_pre(s, false);
}
static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) {