0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-08-11 23:53:04 +00:00
Files
termux-packages/packages/htop/procstat
marcusz 287cf1e176 fix(main/htop): use access() function instead of getuid() (#11013)
The getuid() root checks produces undesired behavior if this function is used
instead of proper checks for file permissions whether the `/proc/stat` can be
accessed or not.

- If `htop` runs in fake root environments (proot/fakeroot), the getuid()
function would obviously return the root user id. as a result, it will use the
actual /proc/stat file and would fail in case the user does not have `/proc/stat` access.

- The getuid() checks is the unreliable way of checking the
permissions of `/proc/stat` file as suppose that it would always require root for
checking the readability of the process status file and use it.
using access() function should allow proper checks regardless of a logged user account.

This change would likely replace the postinst checks of /proc/stat file and include
the fake process status file in the deb package instead
2022-06-18 16:31:58 +08:00

1.1 KiB