check if setting exists
This commit is contained in:
@@ -159,10 +159,18 @@ METHOD(os_info_t, get_setting, chunk_t,
|
|||||||
* In order to guarantee privacy, only settings from the
|
* In order to guarantee privacy, only settings from the
|
||||||
* /etc/, /proc/ and /sys/ directories can be retrieved
|
* /etc/, /proc/ and /sys/ directories can be retrieved
|
||||||
*/
|
*/
|
||||||
|
DBG1(DBG_IMC, "not allowed to access \"%s\"", name);
|
||||||
|
|
||||||
return chunk_empty;
|
return chunk_empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = fopen(name, "r");
|
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)
|
while (i < sizeof(buf) && fread(buf + i, 1, 1, file) == 1)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@@ -267,7 +267,6 @@ static void add_settings(enumerator_t *enumerator, imc_msg_t *msg)
|
|||||||
value = os->get_setting(os, name);
|
value = os->get_setting(os, name);
|
||||||
if (!value.ptr)
|
if (!value.ptr)
|
||||||
{
|
{
|
||||||
DBG1(DBG_IMC, " failed to get setting");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (first)
|
if (first)
|
||||||
|
|||||||
Reference in New Issue
Block a user