diff options
author | Kenny Levinsen <kl@kl.wtf> | 2020-08-03 01:26:31 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2020-08-03 02:13:47 +0200 |
commit | c35b2d2d8848957c1761fe107352fd989c3915f4 (patch) | |
tree | ba88bacd5c546a48ae4c67a8b76dd6ae39fc6905 /seatd/seatd.c | |
parent | d68c5feaee9b294d071c0825f5600e316c728708 (diff) |
server: Stack-allocate the server
Diffstat (limited to 'seatd/seatd.c')
-rw-r--r-- | seatd/seatd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/seatd/seatd.c b/seatd/seatd.c index 0c83253..d0ff7e1 100644 --- a/seatd/seatd.c +++ b/seatd/seatd.c @@ -29,8 +29,8 @@ int main(int argc, char *argv[]) { } libseat_log_init(level); - struct server *server = server_create(); - if (server == NULL) { + struct server server = {0}; + if (server_init(&server) == -1) { log_errorf("server_create failed: %s", strerror(errno)); return 1; } @@ -39,22 +39,22 @@ int main(int argc, char *argv[]) { path = "/run/seatd.sock"; } - if (server_listen(server, path) == -1) { + if (server_listen(&server, path) == -1) { log_errorf("server_listen failed: %s", strerror(errno)); - server_destroy(server); + server_finish(&server); return 1; } log_info("seatd started"); - while (server->running) { - if (poller_poll(&server->poller) == -1) { + while (server.running) { + if (poller_poll(&server.poller) == -1) { log_errorf("poller failed: %s", strerror(errno)); return 1; } } - server_destroy(server); + server_finish(&server); unlink(path); return 0; } |