diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-20 04:32:00 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-20 04:33:14 +0200 |
commit | 799e2d46923728ac670d7110f764868b82333a0b (patch) | |
tree | ff206e5bc62672ed31910e7ca52aed7b106618b1 /src/mds-base.c | |
parent | misc, mostly mds-base re-exec (diff) | |
download | mds-799e2d46923728ac670d7110f764868b82333a0b.tar.gz mds-799e2d46923728ac670d7110f764868b82333a0b.tar.bz2 mds-799e2d46923728ac670d7110f764868b82333a0b.tar.xz |
Modify mds-server to use mds-base (some regression...)
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-base.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mds-base.c b/src/mds-base.c index 1de8c68..65e5d88 100644 --- a/src/mds-base.c +++ b/src/mds-base.c @@ -58,11 +58,14 @@ int socket_fd = -1; */ static int parse_cmdline(void) { + int i; + #if (LIBEXEC_ARGC_EXTRA_LIMIT < 2) # error LIBEXEC_ARGC_EXTRA_LIMIT is too small, need at least 2. #endif - int i; + + /* Parse command line arguments. */ for (i = 1; i < argc; i++) { char* arg = argv[i]; @@ -85,6 +88,12 @@ static int parse_cmdline(void) is_respawn = 1; eprint("re-exec performed."); } + + /* Check that manditory arguments have been specified. */ + exit_if (is_respawn < 0, + eprintf("missing state argument, require either %s or %s.", + "--initial-spawn", "--respawn");); + return 0; } @@ -199,17 +208,18 @@ static int base_marshal(int reexec_fd) /* Store the state. */ buf_set_next(state_buf_, int, socket_fd); - marshal_server(state_buf_); + fail_if (marshal_server(state_buf_)); /* Send the marshalled data into the file. */ fail_if (full_write(reexec_fd, state_buf, state_n) < 0); - free(state_buf); + free(state_buf); return 0; pfail: perror(*argv); + free(state_buf); return 1; } @@ -285,6 +295,9 @@ int main(int argc_, char** argv_) trap_signals(); + /* Initialise the server. */ + try (preinitialise_server()); + if (is_reexec == 0) { if (server_characteristics.require_display) @@ -300,6 +313,9 @@ int main(int argc_, char** argv_) try (base_unmarshal()); } + /* Initialise the server. */ + try (postinitialise_server()); + /* Run the server. */ try (master_loop()); |