batget - fix warnings about buffer sizes

not an actual bug but too much warning noise.
This commit is contained in:
Carsten Haitzler 2017-08-04 14:53:30 +09:00 committed by Mike Blumenkrantz
parent d46de408c7
commit 06dbb255c8
1 changed files with 3 additions and 10 deletions

View File

@ -985,6 +985,9 @@ linux_acpi_init(void)
if (bats)
{
Eina_File_Direct_Info *info;
FILE *f;
char *tmp;
char buf[(PATH_MAX * 2) + 128];
have_power = 0;
powers = eina_file_direct_ls("/proc/acpi/ac_adapter");
@ -992,16 +995,11 @@ linux_acpi_init(void)
{
EINA_ITERATOR_FOREACH(powers, info)
{
char buf[PATH_MAX];
FILE *f;
if (info->name_length + sizeof("/state") >= sizeof(buf)) continue;
snprintf(buf, sizeof(buf), "%s/state", info->path);
f = fopen(buf, "r");
if (f)
{
char *tmp;
/* state */
tmp = fgets(buf, sizeof(buf), f);
if (tmp) tmp = str_get(tmp);
@ -1021,15 +1019,10 @@ linux_acpi_init(void)
acpi_max_design = 0;
EINA_ITERATOR_FOREACH(bats, info)
{
char buf[PATH_MAX + 6];
FILE *f;
snprintf(buf, sizeof(buf), "%s/info", info->path);
f = fopen(buf, "r");
if (f)
{
char *tmp;
/* present */
tmp = fgets(buf, sizeof(buf), f);
if (tmp) tmp = str_get(tmp);