batget - fix warnings about buffer sizes
not an actual bug but too much warning noise.
This commit is contained in:
parent
d46de408c7
commit
06dbb255c8
|
@ -985,6 +985,9 @@ linux_acpi_init(void)
|
||||||
if (bats)
|
if (bats)
|
||||||
{
|
{
|
||||||
Eina_File_Direct_Info *info;
|
Eina_File_Direct_Info *info;
|
||||||
|
FILE *f;
|
||||||
|
char *tmp;
|
||||||
|
char buf[(PATH_MAX * 2) + 128];
|
||||||
|
|
||||||
have_power = 0;
|
have_power = 0;
|
||||||
powers = eina_file_direct_ls("/proc/acpi/ac_adapter");
|
powers = eina_file_direct_ls("/proc/acpi/ac_adapter");
|
||||||
|
@ -992,16 +995,11 @@ linux_acpi_init(void)
|
||||||
{
|
{
|
||||||
EINA_ITERATOR_FOREACH(powers, info)
|
EINA_ITERATOR_FOREACH(powers, info)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
if (info->name_length + sizeof("/state") >= sizeof(buf)) continue;
|
if (info->name_length + sizeof("/state") >= sizeof(buf)) continue;
|
||||||
snprintf(buf, sizeof(buf), "%s/state", info->path);
|
snprintf(buf, sizeof(buf), "%s/state", info->path);
|
||||||
f = fopen(buf, "r");
|
f = fopen(buf, "r");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
/* state */
|
/* state */
|
||||||
tmp = fgets(buf, sizeof(buf), f);
|
tmp = fgets(buf, sizeof(buf), f);
|
||||||
if (tmp) tmp = str_get(tmp);
|
if (tmp) tmp = str_get(tmp);
|
||||||
|
@ -1021,15 +1019,10 @@ linux_acpi_init(void)
|
||||||
acpi_max_design = 0;
|
acpi_max_design = 0;
|
||||||
EINA_ITERATOR_FOREACH(bats, info)
|
EINA_ITERATOR_FOREACH(bats, info)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX + 6];
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/info", info->path);
|
snprintf(buf, sizeof(buf), "%s/info", info->path);
|
||||||
f = fopen(buf, "r");
|
f = fopen(buf, "r");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
/* present */
|
/* present */
|
||||||
tmp = fgets(buf, sizeof(buf), f);
|
tmp = fgets(buf, sizeof(buf), f);
|
||||||
if (tmp) tmp = str_get(tmp);
|
if (tmp) tmp = str_get(tmp);
|
||||||
|
|
Loading…
Reference in New Issue