From 4619901ec4b82d233a24e26ef3df01ddadc2d013 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 28 Jan 2012 21:09:50 -0500 Subject: [PATCH] add linux setfs[ug]id syscall wrappers patch by Jeremy Huntwork --- include/sys/fsuid.h | 20 ++++++++++++++++++++ src/linux/setfsgid.c | 8 ++++++++ src/linux/setfsuid.c | 8 ++++++++ 3 files changed, 36 insertions(+) create mode 100644 include/sys/fsuid.h create mode 100644 src/linux/setfsgid.c create mode 100644 src/linux/setfsuid.c diff --git a/include/sys/fsuid.h b/include/sys/fsuid.h new file mode 100644 index 00000000..f62184c5 --- /dev/null +++ b/include/sys/fsuid.h @@ -0,0 +1,20 @@ +#ifndef _FSUID_H +#define _FSUID_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_uid_t +#define __NEED_gid_t + +#include + +int setfsuid(uid_t); +int setfsgid(gid_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/linux/setfsgid.c b/src/linux/setfsgid.c new file mode 100644 index 00000000..a7ed9e92 --- /dev/null +++ b/src/linux/setfsgid.c @@ -0,0 +1,8 @@ +#include +#include "syscall.h" +#include "libc.h" + +int setfsgid(gid_t gid) +{ + return syscall(SYS_setfsgid, gid); +} diff --git a/src/linux/setfsuid.c b/src/linux/setfsuid.c new file mode 100644 index 00000000..1509e0aa --- /dev/null +++ b/src/linux/setfsuid.c @@ -0,0 +1,8 @@ +#include +#include "syscall.h" +#include "libc.h" + +int setfsuid(uid_t uid) +{ + return syscall(SYS_setfsuid, uid); +} -- 2.25.1