summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2020-08-28 16:57:21 +1000
committerNathan Scott <nathans@redhat.com>2020-08-28 16:57:21 +1000
commitb992d52bcf8ff8c51c847cd4bbf33a7db441dbe9 (patch)
tree137c6afd11ea58dbcd5c9abf0e318654ec5d4a4f
parentb5e6952cc6edaf4d54478f5fb23712c85e148912 (diff)
Increae the size of sysfs power supply path buffers
Resolves https://github.com/htop-dev/htop/issues/15
-rw-r--r--linux/Battery.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/linux/Battery.c b/linux/Battery.c
index 4014a500..a8784da0 100644
--- a/linux/Battery.c
+++ b/linux/Battery.c
@@ -107,7 +107,7 @@ static ACPresence procAcpiCheck() {
if (entryName[0] != 'A')
continue;
- char statePath[50];
+ char statePath[256];
xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
FILE* file = fopen(statePath, "r");
if (!file) {
@@ -191,7 +191,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
if (!dirEntry)
break;
char* entryName = (char *) dirEntry->d_name;
- const char filePath[50];
+ const char filePath[256];
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);
int fd1 = open(filePath, O_RDONLY);