aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-08-04 14:53:30 +0900
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-09-01 13:51:39 -0400
commit06dbb255c8fdf6cde5af79627b29c4b957d8e477 (patch)
treeb573b28d241ef4c4690247eec9890dfd05585a6b
parentadd time config event rects to gadget popups list (diff)
downloadenlightenment-06dbb255c8fdf6cde5af79627b29c4b957d8e477.tar.gz
batget - fix warnings about buffer sizes
not an actual bug but too much warning noise.
-rw-r--r--src/modules/battery/batget.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/modules/battery/batget.c b/src/modules/battery/batget.c
index 6e921c376..224dedfc5 100644
--- a/src/modules/battery/batget.c
+++ b/src/modules/battery/batget.c
@@ -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);