diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2013-03-22 02:45:11 -0700 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2013-05-06 16:28:11 +0200 |
commit | 132e9156249912a08c354431c55015827cf2be1a (patch) | |
tree | 334efbc2183cc8f2afc3782d1b612fda2f473ce8 /src | |
parent | cbac788a657aa04a0d48a598be640854331b1035 (diff) |
engine: call getenv() only once
Helps Klocwork, which otherwise warned about the potential
NULL return from the second call.
Diffstat (limited to 'src')
-rw-r--r-- | src/syncevo/SyncContext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/syncevo/SyncContext.cpp b/src/syncevo/SyncContext.cpp index 5a1c5b22..f2bc3922 100644 --- a/src/syncevo/SyncContext.cpp +++ b/src/syncevo/SyncContext.cpp @@ -2872,7 +2872,7 @@ void SyncContext::initMain(const char *appname) // pulls it into the process by loading libecal. EDSAbiWrapperInit(); - if (getenv("SYNCEVOLUTION_GNUTLS_DEBUG")) { + if (const char *gnutlsdbg = getenv("SYNCEVOLUTION_GNUTLS_DEBUG")) { // Enable libgnutls debugging without creating a hard dependency on it, // because we don't call it directly and might not even be linked against // it. Therefore check for the relevant symbols via dlsym(). @@ -2884,7 +2884,7 @@ void SyncContext::initMain(const char *appname) set_log_function = (typeof(set_log_function))dlsym(RTLD_DEFAULT, "gnutls_global_set_log_function"); if (set_log_level && set_log_function) { - set_log_level(atoi(getenv("SYNCEVOLUTION_GNUTLS_DEBUG"))); + set_log_level(atoi(gnutlsdbg)); set_log_function(GnutlsLogFunction); } else { SE_LOG_ERROR(NULL, NULL, "SYNCEVOLUTION_GNUTLS_DEBUG debugging not possible, log functions not found"); |