* Restconf internal start: fail early if clixon_restconf binary is not found

* If CLICON_BACKEND_RESTCONF_PROCESS is true
This commit is contained in:
Olof hagsand 2021-08-17 10:08:04 +02:00
parent 980718178a
commit 8352e25860
5 changed files with 31 additions and 8 deletions

View file

@ -98,6 +98,7 @@
#ifdef HAVE_SETNS /* linux network namespaces */
#include <sched.h> /* setns / unshare */
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
@ -271,6 +272,7 @@ clixon_proc_background(char **argv,
sigfn_t oldhandler = NULL;
sigset_t oset;
struct rlimit rlim = {0, };
struct stat fstat;
clicon_debug(1, "%s", __FUNCTION__);
if (argv == NULL){
@ -284,6 +286,11 @@ clixon_proc_background(char **argv,
i++;
}
}
/* Sanity check: program exists */
if (stat(argv[0], &fstat) < 0) {
clicon_err(OE_FATAL, errno, "%s", argv[0]);
goto quit;
}
/* Before here call quit on error */
sigprocmask(0, NULL, &oset);
set_signal(SIGINT, clixon_proc_sigint, &oldhandler);