[PATCH v3 0/1] MR134: ntdll: Don't hard-code the battery and AC adapter names on Linux
Alexandre Julliard (@julliard)
wine at gitlab.winehq.org
Wed Jun 15 14:36:41 CDT 2022
Alexandre Julliard (@julliard) commented about dlls/ntdll/unix/system.c:
> - bs->AcOnLine = get_sys_int("/sys/class/power_supply/AC/online", 1);
> + bs->AcOnLine = TRUE;
> + if (!d) return STATUS_SUCCESS;
>
> - for (;;)
> + while ((de = readdir(d)))
> {
> - sprintf(path, "/sys/class/power_supply/BAT%u/status", i);
> - if (!get_sys_str(path, s)) break;
> - bs->Charging |= (strcmp(s, "Charging\n") == 0);
> - bs->Discharging |= (strcmp(s, "Discharging\n") == 0);
> - bs->BatteryPresent = TRUE;
> - i++;
> - }
> + if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) continue;
> + if (snprintf(path, sizeof(path), "/sys/class/power_supply/%s", de->d_name) < 0) continue;
Same here.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/134#note_2142
More information about the wine-devel
mailing list