From 3ff396db6a64705b916abf32e470356f3e8a2db1 Mon Sep 17 00:00:00 2001 From: buffet Date: Wed, 17 Oct 2018 09:53:23 +0200 Subject: [PATCH] Implemented exec_config --- src/kiwmi/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/kiwmi/main.c b/src/kiwmi/main.c index bcac596..9020111 100644 --- a/src/kiwmi/main.c +++ b/src/kiwmi/main.c @@ -6,9 +6,11 @@ #include #include #include +#include #include "common.h" +static void exec_config(const char *path); static void sig_handler(int sig); int g_is_about_to_quit = 0; @@ -19,6 +21,8 @@ main(int argc, char *argv[]) char config_path[PATH_MAX]; int option; + argv0 = argv[0]; + config_path[0] = '\0'; while ((option = getopt(argc, argv, "hvc:")) != -1) { @@ -63,6 +67,21 @@ main(int argc, char *argv[]) signal(SIGTERM, sig_handler); signal(SIGCHLD, sig_handler); signal(SIGPIPE, SIG_IGN); + + exec_config(config_path); +} + +static void +exec_config(const char *path) +{ + switch(fork()) { + case -1: + warn("failed to execute config\n"); + break; + case 0: + execl(path, path, NULL); + die("failed to execute config\n"); + } } static void