diff --git a/src/base/system.h b/src/base/system.h index 38ad314fc..bcb3b46e2 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -2637,7 +2637,7 @@ void generate_password(char *buffer, unsigned length, const unsigned short *rand * * @return `0` on success. */ -int secure_random_init(); +[[nodiscard]] int secure_random_init(); /** * Uninitializes the secure random module. diff --git a/src/tools/stun.cpp b/src/tools/stun.cpp index c735dec83..4329f575e 100644 --- a/src/tools/stun.cpp +++ b/src/tools/stun.cpp @@ -6,8 +6,12 @@ int main(int argc, const char **argv) { CCmdlineFix CmdlineFix(&argc, &argv); - secure_random_init(); log_set_global_logger_default(); + if(secure_random_init() != 0) + { + log_error("stun", "could not initialize secure RNG"); + return -1; + } if(argc < 2) { diff --git a/src/tools/twping.cpp b/src/tools/twping.cpp index e0bf60012..b48f8d4a6 100644 --- a/src/tools/twping.cpp +++ b/src/tools/twping.cpp @@ -11,8 +11,12 @@ int main(int argc, const char **argv) { CCmdlineFix CmdlineFix(&argc, &argv); - secure_random_init(); log_set_global_logger_default(); + if(secure_random_init() != 0) + { + log_error("twping", "could not initialize secure RNG"); + return -1; + } net_init(); NETADDR BindAddr;