summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-18 16:36:16 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-18 16:36:16 +0200
commit87dd930beddef23e7278df476584d9071b76929c (patch)
tree08fad728710df457a0856b93ebe55be350a15991 /src/fastd.c
parentdd5d95468e98c8ad009de2297a12544daa30ad29 (diff)
downloadfastd-87dd930beddef23e7278df476584d9071b76929c.tar
fastd-87dd930beddef23e7278df476584d9071b76929c.zip
Clean up shell command handling
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/fastd.c b/src/fastd.c
index c6fec8b..9761715 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -270,19 +270,19 @@ void fastd_handle_receive(fastd_context_t *ctx, fastd_peer_t *peer, fastd_buffer
}
static inline void on_pre_up(fastd_context_t *ctx) {
- fastd_shell_command_exec(ctx, &ctx->conf->on_pre_up, NULL, NULL, NULL, NULL);
+ fastd_shell_command_exec(ctx, &ctx->conf->on_pre_up, NULL, NULL, NULL);
}
static inline void on_up(fastd_context_t *ctx) {
- fastd_shell_command_exec(ctx, &ctx->conf->on_up, NULL, NULL, NULL, NULL);
+ fastd_shell_command_exec(ctx, &ctx->conf->on_up, NULL, NULL, NULL);
}
static inline void on_down(fastd_context_t *ctx) {
- fastd_shell_command_exec(ctx, &ctx->conf->on_down, NULL, NULL, NULL, NULL);
+ fastd_shell_command_exec(ctx, &ctx->conf->on_down, NULL, NULL, NULL);
}
static inline void on_post_down(fastd_context_t *ctx) {
- fastd_shell_command_exec(ctx, &ctx->conf->on_post_down, NULL, NULL, NULL, NULL);
+ fastd_shell_command_exec(ctx, &ctx->conf->on_post_down, NULL, NULL, NULL);
}
static fastd_peer_group_t* init_peer_group(const fastd_peer_group_config_t *config, fastd_peer_group_t *parent) {
@@ -699,9 +699,6 @@ static void write_pid(fastd_context_t *ctx, pid_t pid) {
}
static void set_user(fastd_context_t *ctx) {
- if (chdir("/"))
- pr_error(ctx, "can't chdir to `/': %s", strerror(errno));
-
if (ctx->conf->user || ctx->conf->group) {
if (setgid(ctx->conf->gid) < 0)
exit_errno(ctx, "setgid");
@@ -899,6 +896,9 @@ int main(int argc, char *argv[]) {
if (conf.daemon)
status_fd = daemonize(&ctx);
+ if (chdir("/"))
+ pr_error(&ctx, "can't chdir to `/': %s", strerror(errno));
+
init_log(&ctx);
#ifdef HAVE_LIBSODIUM