diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-16 23:24:39 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-16 23:24:39 +0200 |
commit | 8d567588cad053f79abe603ab113e1b85a92f1da (patch) | |
tree | d29f8cbd6233fac569b84774d7a72a5fd8049b29 /socket.c | |
parent | 2076ca540e4ffdd320e086c8b570a5bf19546022 (diff) |
automount: implement automount unit type
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -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) { |