From b7a17d62c73a0be53ee3ce2940e623ebe4a1252c Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Thu, 6 Oct 2022 06:54:01 +0200 Subject: Improved OpenWrt UCI/Initscript * c-analysed: chuser()/chgroup() Signed-off-by: Toni Uhlig --- examples/c-analysed/c-analysed.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'examples') diff --git a/examples/c-analysed/c-analysed.c b/examples/c-analysed/c-analysed.c index 223532c1c..eaf4030e9 100644 --- a/examples/c-analysed/c-analysed.c +++ b/examples/c-analysed/c-analysed.c @@ -557,6 +557,20 @@ int main(int argc, char ** argv) } openlog("nDPIsrvd-analyzed", LOG_CONS, LOG_DAEMON); + errno = 0; + if (user != NULL && change_user_group(user, group, pidfile, csv_outfile /* :D */, NULL) != 0) + { + if (errno != 0) + { + syslog(LOG_DAEMON | LOG_ERR, "Change user/group failed: %s", strerror(errno)); + } + else + { + syslog(LOG_DAEMON | LOG_ERR, "Change user/group failed."); + } + return 1; + } + if (nDPIsrvd_set_read_timeout(sock, 180, 0) != 0) { return 1; -- cgit v1.2.3