check if setting exists

This commit is contained in:
Andreas Steffen
2012-11-01 19:26:29 +01:00
parent efe0d5478f
commit 8128f255f4
2 changed files with 8 additions and 1 deletions
+8
View File
@@ -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++;