Execute config file

This commit is contained in:
buffet 2018-09-30 20:07:00 +02:00
parent cbe0f0cbe6
commit 972d001fd6

View file

@ -30,6 +30,8 @@ main(int argc, char *argv[])
@{open ipc connection} @{open ipc connection}
@{setup signal handlers} @{setup signal handlers}
@{execute config}
} }
--- ---
@ -254,3 +256,29 @@ Which of course requires this.
#include <signal.h> #include <signal.h>
#include <sys/wait.h> #include <sys/wait.h>
--- ---
@s Execute config
We'll do this in a function, so we can execute later on, when the user requests it.
--- function definitions +=
static void
exec_config(const char *path)
{
switch (fork()) {
case -1:
fprintf(stderr, "%s: failed to execute config\n", argv0);
break;
case 0:
execl(path, path, NULL);
die("%s: failed to execute config\n", argv0);
break;
}
}
---
We need to invoke this once all the connections are open
--- execute config
exec_config(config_path);
---