mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-11-02 03:07:49 +00:00
Added env check NDPID_STARTED_BY_SYSTEMD to prevent logging to stderr in such a case
* removed `nDPId` shutdown on poll/epoll error * fixed `chmod_chown()` rv check Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
1
nDPId.c
1
nDPId.c
@@ -4881,7 +4881,6 @@ static void run_capture_loop(struct nDPId_reader_thread * const reader_thread)
|
|||||||
if (nio_has_error(&io, i) == NIO_SUCCESS)
|
if (nio_has_error(&io, i) == NIO_SUCCESS)
|
||||||
{
|
{
|
||||||
logger(1, "%s", "Event I/O error");
|
logger(1, "%s", "Event I/O error");
|
||||||
MT_GET_AND_ADD(reader_thread->workflow->error_or_eof, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd = nio_get_fd(&io, i);
|
int fd = nio_get_fd(&io, i);
|
||||||
|
|||||||
@@ -1834,7 +1834,7 @@ int main(int argc, char ** argv)
|
|||||||
GET_CMDARG_STR(nDPIsrvd_options.user),
|
GET_CMDARG_STR(nDPIsrvd_options.user),
|
||||||
strerror(ret));
|
strerror(ret));
|
||||||
}
|
}
|
||||||
if (ret != -EPERM)
|
if (ret != EPERM)
|
||||||
{
|
{
|
||||||
goto error_unlink_sockets;
|
goto error_unlink_sockets;
|
||||||
}
|
}
|
||||||
@@ -1867,7 +1867,7 @@ int main(int argc, char ** argv)
|
|||||||
GET_CMDARG_STR(nDPIsrvd_options.user),
|
GET_CMDARG_STR(nDPIsrvd_options.user),
|
||||||
strerror(ret));
|
strerror(ret));
|
||||||
}
|
}
|
||||||
if (ret != -EPERM)
|
if (ret != EPERM)
|
||||||
{
|
{
|
||||||
goto error_unlink_sockets;
|
goto error_unlink_sockets;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Type=simple
|
|||||||
ExecStartPre=/bin/sh -c 'test -r "@CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf" || cp -v "@CMAKE_INSTALL_PREFIX@/share/nDPId/ndpid.conf.example" "@CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf"'
|
ExecStartPre=/bin/sh -c 'test -r "@CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf" || cp -v "@CMAKE_INSTALL_PREFIX@/share/nDPId/ndpid.conf.example" "@CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf"'
|
||||||
ExecStart=@CMAKE_INSTALL_PREFIX@/sbin/nDPId -f @CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf -i %i -u ndpid -c /run/nDPIsrvd/collector
|
ExecStart=@CMAKE_INSTALL_PREFIX@/sbin/nDPId -f @CMAKE_INSTALL_PREFIX@/etc/nDPId/%i.conf -i %i -u ndpid -c /run/nDPIsrvd/collector
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
Environment="NDPID_STARTED_BY_SYSTEMD="
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ After=network.target
|
|||||||
Type=simple
|
Type=simple
|
||||||
ExecStartPre=/bin/sh -c 'test -r "@CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf" || cp -v "@CMAKE_INSTALL_PREFIX@/share/nDPId/ndpisrvd.conf.example" "@CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf"'
|
ExecStartPre=/bin/sh -c 'test -r "@CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf" || cp -v "@CMAKE_INSTALL_PREFIX@/share/nDPId/ndpisrvd.conf.example" "@CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf"'
|
||||||
ExecStartPre=/bin/sh -c 'mkdir -p /run/nDPIsrvd && chown root:root /run/nDPIsrvd && chmod 0775 /run/nDPIsrvd'
|
ExecStartPre=/bin/sh -c 'mkdir -p /run/nDPIsrvd && chown root:root /run/nDPIsrvd && chmod 0775 /run/nDPIsrvd'
|
||||||
|
ExecStopPost=/bin/sh -c 'rm -f /run/nDPIsrvd/collector /run/nDPIsrvd/distributor'
|
||||||
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/nDPIsrvd -f @CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf -u ndpisrvd -c /run/nDPIsrvd/collector -s /run/nDPIsrvd/distributor -G ndpid:ndpisrvd-distributor
|
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/nDPIsrvd -f @CMAKE_INSTALL_PREFIX@/etc/nDPId/nDPIsrvd.conf -u ndpisrvd -c /run/nDPIsrvd/collector -s /run/nDPIsrvd/distributor -G ndpid:ndpisrvd-distributor
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
Environment="NDPID_STARTED_BY_SYSTEMD="
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
3
utils.c
3
utils.c
@@ -586,9 +586,12 @@ __attribute__((format(printf, 2, 3))) void logger_early(int is_error, char const
|
|||||||
int old_log_to_console = log_to_console;
|
int old_log_to_console = log_to_console;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
if (getenv("NDPID_STARTED_BY_SYSTEMD") == NULL)
|
||||||
|
{
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vlogger_to(fileno(stderr), is_error, format, &ap);
|
vlogger_to(fileno(stderr), is_error, format, &ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
log_to_console = 0;
|
log_to_console = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user