diff options
author | Martin Willi <martin@revosec.ch> | 2011-04-21 10:57:17 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2011-04-21 10:57:17 +0200 |
commit | fdead26ffe1da8501a6ff5e0639a6f44c723e763 (patch) | |
tree | 6f7685c84b126b77badb256472a445f24fca5327 /src | |
parent | 3e2419ebe32de72d824864eb2e0e677a7c197af1 (diff) | |
download | strongswan-fdead26ffe1da8501a6ff5e0639a6f44c723e763.tar.bz2 strongswan-fdead26ffe1da8501a6ff5e0639a6f44c723e763.tar.xz |
If key not found, strdup default value, too
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/settings.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libstrongswan/settings.c b/src/libstrongswan/settings.c index 395ae65e3..941eb0514 100644 --- a/src/libstrongswan/settings.c +++ b/src/libstrongswan/settings.c @@ -453,14 +453,10 @@ METHOD(settings_t, alloc_str, char*, va_start(args, def); /* additional lock to savely strdup */ this->lock->read_lock(this->lock); - value = strdupnull(find_value(this, this->top, key, args)); + value = strdupnull(find_value(this, this->top, key, args) ?: def); this->lock->unlock(this->lock); va_end(args); - if (value) - { - return value; - } - return def; + return value; } /** |