From: Kirill Isakov Date: Thu, 2 Jun 2022 12:47:18 +0000 (+0600) Subject: Silence clang-tidy warnings about atoi(getenv()) X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=28be4baae016a5a771d0d9ec6e97ef38a4fc9e46;p=tinc Silence clang-tidy warnings about atoi(getenv()) --- diff --git a/src/net_setup.c b/src/net_setup.c index b88f5262..dd6c58f1 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -1086,11 +1086,13 @@ static bool setup_myself(void) { /* Open sockets */ - if(!do_detach && getenv("LISTEN_FDS")) { + const char *listen_fds = getenv("LISTEN_FDS"); + + if(!do_detach && listen_fds) { sockaddr_t sa; socklen_t salen; - listen_sockets = atoi(getenv("LISTEN_FDS")); + listen_sockets = atoi(listen_fds); #ifdef HAVE_UNSETENV unsetenv("LISTEN_FDS"); #endif diff --git a/src/tincd.c b/src/tincd.c index 1c9b6ed6..db719839 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -563,7 +563,9 @@ int main(int argc, char **argv) { g_argv = argv; - if(getenv("LISTEN_PID") && atoi(getenv("LISTEN_PID")) == getpid()) { + const char *listen_pid = getenv("LISTEN_PID"); + + if(listen_pid && atoi(listen_pid) == getpid()) { do_detach = false; }