manager: fix integer underflow in get_manager_uid (#591)

This commit fixes the issue where the "uid_t" type variable, typedef'd from unsigned int, was being assigned -1, causing an integer underflow.
This commit is contained in:
Pedro.js
2025-06-30 16:17:15 +00:00
committed by GitHub
parent 5e33aee99f
commit aaf776f421
2 changed files with 2 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ int get_version(void) {
} }
uid_t get_manager_uid() { uid_t get_manager_uid() {
uid_t manager_uid = (uid_t)-1; uid_t manager_uid = 0;
ksuctl(CMD_GET_MANAGER_UID, &manager_uid, nullptr); ksuctl(CMD_GET_MANAGER_UID, &manager_uid, nullptr);
return manager_uid; return manager_uid;
} }

View File

@@ -59,7 +59,7 @@ object Natives {
/** /**
* Get the UID of the current root manager. * Get the UID of the current root manager.
* @return manager UID, or -1 if unavailable. * @return manager UID, or 0 if unavailable.
*/ */
external fun getManagerUid(): Int external fun getManagerUid(): Int