From: Andreas Steffen Date: Thu, 1 Nov 2012 18:26:29 +0000 (+0100) Subject: check if setting exists X-Git-Tag: 5.0.2dr4~249 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8128f255f403b8858d40cda749338b593f7302d1;p=thirdparty%2Fstrongswan.git check if setting exists --- diff --git a/src/libimcv/os_info/os_info.c b/src/libimcv/os_info/os_info.c index 05e335fb98..d5fa4b929a 100644 --- a/src/libimcv/os_info/os_info.c +++ b/src/libimcv/os_info/os_info.c @@ -159,10 +159,18 @@ METHOD(os_info_t, get_setting, chunk_t, * In order to guarantee privacy, only settings from the * /etc/, /proc/ and /sys/ directories can be retrieved */ + DBG1(DBG_IMC, "not allowed to access \"%s\"", name); + return chunk_empty; } file = fopen(name, "r"); + if (!file) + { + DBG1(DBG_IMC, "failed to open \"%s\"", name); + + return chunk_empty; + } while (i < sizeof(buf) && fread(buf + i, 1, 1, file) == 1) { i++; diff --git a/src/libimcv/plugins/imc_os/imc_os.c b/src/libimcv/plugins/imc_os/imc_os.c index 7510b26193..f8fe7eadd2 100644 --- a/src/libimcv/plugins/imc_os/imc_os.c +++ b/src/libimcv/plugins/imc_os/imc_os.c @@ -267,7 +267,6 @@ static void add_settings(enumerator_t *enumerator, imc_msg_t *msg) value = os->get_setting(os, name); if (!value.ptr) { - DBG1(DBG_IMC, " failed to get setting"); continue; } if (first)