summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-10-06 06:54:01 +0200
committerToni Uhlig <matzeton@googlemail.com>2022-10-06 06:54:01 +0200
commitb7a17d62c73a0be53ee3ce2940e623ebe4a1252c (patch)
tree4768ceb8d230d0a8f3beda798624757ce2d057b7 /examples
parentac46f3841f985579712a69207bee5f497a9476f7 (diff)
Improved OpenWrt UCI/Initscript
* c-analysed: chuser()/chgroup() Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/c-analysed/c-analysed.c14
1 files changed, 14 insertions, 0 deletions
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;