aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2012-11-01 19:26:29 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2012-11-01 19:26:29 +0100
commit8128f255f403b8858d40cda749338b593f7302d1 (patch)
tree35571d6b3bc5653f6a154e5c7588d0cd6f8bb090
parentefe0d5478f16fa7f65b7bccbc018bc115b72c50d (diff)
downloadstrongswan-8128f255f403b8858d40cda749338b593f7302d1.tar.bz2
strongswan-8128f255f403b8858d40cda749338b593f7302d1.tar.xz
check if setting exists
-rw-r--r--src/libimcv/os_info/os_info.c8
-rw-r--r--src/libimcv/plugins/imc_os/imc_os.c1
2 files changed, 8 insertions, 1 deletions
diff --git a/src/libimcv/os_info/os_info.c b/src/libimcv/os_info/os_info.c
index 05e335fb9..d5fa4b929 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 7510b2619..f8fe7eadd 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)