diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-02 18:08:17 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-02 18:08:17 +0000 |
commit | c7243b73cb3baaf6993d8a9dfb16c054c3978040 (patch) | |
tree | 1d67ee4c5cf764dc83245c79d27da52857b4a89d /server.c | |
parent | 11ee55e755af67dc9155e956b4569c8fdeb11848 (diff) | |
download | rtmux-c7243b73cb3baaf6993d8a9dfb16c054c3978040.tar.gz rtmux-c7243b73cb3baaf6993d8a9dfb16c054c3978040.tar.bz2 rtmux-c7243b73cb3baaf6993d8a9dfb16c054c3978040.zip |
Move -s and -c down a level so handling them is the responsibility of the command (with some helper functions), rather than the top-level. This changes the action command syntax so that -s and -c must be after the command rather than before.
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.45 2008-05-31 20:04:15 nicm Exp $ */ +/* $Id: server.c,v 1.46 2008-06-02 18:08:17 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -62,6 +62,7 @@ server_start(const char *path) size_t size; mode_t mask; int n, fd, mode; + char *cause; switch (fork()) { case -1: @@ -109,6 +110,13 @@ server_start(const char *path) if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) fatal("fcntl failed"); + /* Load configuration. */ + if (cfg_file != NULL && load_cfg(cfg_file, &cause) != 0) { + log_warnx("%s", cause); + xfree(cause); + exit(1); + } + if (daemon(1, 1) != 0) fatal("daemon failed"); log_debug("server daemonised, pid now %ld", (long) getpid()); @@ -135,7 +143,7 @@ server_main(const char *srv_path, int srv_fd) ARRAY_INIT(&sessions); key_bindings_init(); - + pfds = NULL; while (!sigterm) { /* Initialise pollfd array. */ |