summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/seteuid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/seteuid.c')
-rw-r--r--libc/sysdeps/linux/common/seteuid.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c
new file mode 100644
index 000000000..179477a14
--- /dev/null
+++ b/libc/sysdeps/linux/common/seteuid.c
@@ -0,0 +1,22 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+
+int seteuid(uid_t uid)
+{
+ switch (sizeof (uid_t))
+ {
+ case 2:
+ if (uid == 65535)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ break;
+
+ default:
+ fprintf (stderr, "Uknown uid_t size and sign\n");
+ }
+
+ return setreuid(-1, uid);
+}