aboutsummaryrefslogtreecommitdiff
path: root/nDPIsrvd.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2024-10-01 11:52:44 +0200
committerToni Uhlig <matzeton@googlemail.com>2024-10-16 13:03:41 +0200
commit752a7e3b80e24e49b260b7e9a7988c0a6348db5b (patch)
tree2b4f865d9872d02cc7af399dd4304d910446e79d /nDPIsrvd.c
parent49c11fee1ecb6135d22a70b9bc3badcc5e0cd340 (diff)
Added support for setting tuning options via config file.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'nDPIsrvd.c')
-rw-r--r--nDPIsrvd.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/nDPIsrvd.c b/nDPIsrvd.c
index 8114e28f6..430e89f92 100644
--- a/nDPIsrvd.c
+++ b/nDPIsrvd.c
@@ -895,10 +895,10 @@ static int nDPIsrvd_parse_options(int argc, char ** argv)
"\t-v\tversion\n"
"\t-h\tthis\n\n",
argv[0],
- GET_CMDARG_STR(nDPIsrvd_options.collector_un_sockpath),
- GET_CMDARG_STR(nDPIsrvd_options.pidfile),
- GET_CMDARG_STR(nDPIsrvd_options.user),
- GET_CMDARG_STR(nDPIsrvd_options.distributor_un_sockpath));
+ nDPIsrvd_options.collector_un_sockpath.string.default_value,
+ nDPIsrvd_options.pidfile.string.default_value,
+ nDPIsrvd_options.user.string.default_value,
+ nDPIsrvd_options.distributor_un_sockpath.string.default_value);
return 1;
}
}
@@ -1673,28 +1673,24 @@ int main(int argc, char ** argv)
break;
}
- errno = 0;
- if (change_user_group(GET_CMDARG_STR(nDPIsrvd_options.user),
- GET_CMDARG_STR(nDPIsrvd_options.group),
- GET_CMDARG_STR(nDPIsrvd_options.pidfile),
- GET_CMDARG_STR(nDPIsrvd_options.collector_un_sockpath),
- GET_CMDARG_STR(nDPIsrvd_options.distributor_un_sockpath)) != 0 &&
- errno != EPERM)
- {
- if (errno != 0)
+ int ret = change_user_group(GET_CMDARG_STR(nDPIsrvd_options.user),
+ GET_CMDARG_STR(nDPIsrvd_options.group),
+ GET_CMDARG_STR(nDPIsrvd_options.pidfile),
+ GET_CMDARG_STR(nDPIsrvd_options.collector_un_sockpath),
+ GET_CMDARG_STR(nDPIsrvd_options.distributor_un_sockpath));
+ if (ret != 0 && ret != -EPERM)
+ {
+ if (GET_CMDARG_STR(nDPIsrvd_options.group) != NULL)
{
logger(1,
"Change user/group to %s/%s failed: %s",
GET_CMDARG_STR(nDPIsrvd_options.user),
- (IS_CMDARG_SET(nDPIsrvd_options.group) != 0 ? GET_CMDARG_STR(nDPIsrvd_options.group) : "-"),
- strerror(errno));
+ GET_CMDARG_STR(nDPIsrvd_options.group),
+ strerror(-ret));
}
else
{
- logger(1,
- "Change user/group to %s/%s failed.",
- GET_CMDARG_STR(nDPIsrvd_options.user),
- (IS_CMDARG_SET(nDPIsrvd_options.group) != 0 ? GET_CMDARG_STR(nDPIsrvd_options.group) : "-"));
+ logger(1, "Change user to %s failed: %s", GET_CMDARG_STR(nDPIsrvd_options.user), strerror(-ret));
}
goto error_unlink_sockets;
}