1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Description: Use gid_t for getgroups(2) and setgroups(2)
Forwarded: no
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2024-08-14
--- a/chkshsgr.c
+++ b/chkshsgr.c
@@ -4,7 +4,7 @@
int main()
{
- short x[4];
+ gid_t x[4];
x[0] = x[1] = 0;
if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
--- a/prot.c
+++ b/prot.c
@@ -6,7 +6,7 @@
int prot_gid(int gid)
{
#ifdef HASSHORTSETGROUPS
- short x[2];
+ gid_t x[2];
x[0] = gid; x[1] = 73; /* catch errors */
if (setgroups(1,x) == -1) return -1;
#else
--- a/tryshsgr.c
+++ b/tryshsgr.c
@@ -1,6 +1,9 @@
+#include <grp.h>
+#include <unistd.h>
+
int main()
{
- short x[4];
+ gid_t x[4];
x[0] = x[1] = 1;
if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
|