diff --git a/libc/inc/stddef.h b/libc/inc/stddef.h index 6eb5b2f..f22e546 100644 --- a/libc/inc/stddef.h +++ b/libc/inc/stddef.h @@ -37,10 +37,10 @@ typedef unsigned int ino_t; typedef unsigned int dev_t; /// The type of user-id. -typedef unsigned int uid_t; +typedef int uid_t; /// The type of group-id. -typedef unsigned int gid_t; +typedef int gid_t; /// The type of offset. typedef long int off_t; diff --git a/mentos/src/process/scheduler.c b/mentos/src/process/scheduler.c index e0192f1..8d1c7a1 100644 --- a/mentos/src/process/scheduler.c +++ b/mentos/src/process/scheduler.c @@ -386,6 +386,9 @@ uid_t sys_getuid(void) int sys_setuid(uid_t uid) { + if (uid < 0) { + return -EINVAL; + } if (runqueue.curr && (runqueue.curr->uid == 0)) { runqueue.curr->uid = uid; return 0; @@ -403,6 +406,9 @@ pid_t sys_getgid(void) int sys_setgid(pid_t gid) { + if (gid < 0) { + return -EINVAL; + } if (runqueue.curr && (runqueue.curr->uid == 0)) { runqueue.curr->gid = gid; return 0;