batman - fix buffer warning by hanving big enough stack buffer

makes gcc warnings happy but otherwise doesn't hurt us as the buffer
should be at the top of the stack (last pushed) and only bytes used
will be allocated.
This commit is contained in:
Carsten Haitzler 2017-08-04 14:08:41 +09:00
parent 03aeb1d463
commit ec37c5e7eb
1 changed files with 3 additions and 10 deletions

View File

@ -802,6 +802,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");
@ -809,16 +812,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);
@ -838,15 +836,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);