commit fc2f8674d726df289e650b79189c4221ff66c8a5
parent c3c65bcdfe53aac4f1bd27f4bfb3faccabfa2fd3
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun, 16 Aug 2020 15:20:03 -0300
prot.c, prot.h: use gid_t and uid_t.
Diffstat:
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/prot.c b/src/prot.c
@@ -3,7 +3,11 @@
#include "hasshsgr.h"
#include "prot.h"
-int prot_gid(int gid)
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+
+int prot_gid(gid_t gid)
{
#ifdef HASSHORTSETGROUPS
short x[2];
@@ -15,7 +19,7 @@ int prot_gid(int gid)
return setgid(gid); /* _should_ be redundant, but on some systems it isn't */
}
-int prot_uid(int uid)
+int prot_uid(uid_t uid)
{
return setuid(uid);
}
diff --git a/src/prot.h b/src/prot.h
@@ -3,7 +3,9 @@
#ifndef PROT_H
#define PROT_H
-extern int prot_gid(int);
-extern int prot_uid(int);
+#include <sys/types.h>
+
+extern int prot_gid(gid_t);
+extern int prot_uid(uid_t);
#endif