From c7243b73cb3baaf6993d8a9dfb16c054c3978040 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 2 Jun 2008 18:08:17 +0000 Subject: 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. --- server.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'server.c') diff --git a/server.c b/server.c index dcd115f3..8cfc607c 100644 --- a/server.c +++ b/server.c @@ -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 @@ -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. */ -- cgit v1.2.3