[PATCH] Move in_egroup_p() to sys.c

Jeff Dike (jdike@karaya.com)
Tue, 07 Dec 1999 20:33:40 -0500


The patch below moves in_egroup_p from sysctl.c to sys.c. This seems like a
good idea because:
It's now right next to in_group_p
sysctl.c is ifdefed on CONFIG_SYSCTL, whereas in_egroup_p is used by dquot.c
which is under CONFIG_QUOTA, so a kernel with CONFIG_SYSCTL off and
CONFIG_QUOTA on fails to link.

Jeff

diff -Naur -X ../../../exclude-files ./sys.c ../../orig/kernel/sys.c
--- ./sys.c Tue Dec 7 20:11:18 1999
+++ ../../orig/kernel/sys.c Fri Oct 29 16:19:49 1999
@@ -804,26 +804,6 @@
return 1;
}

-/* Like in_group_p, but testing against egid, not fsgid */
-int in_egroup_p(gid_t grp)
-{
- if (grp != current->egid) {
- int i = current->ngroups;
- if (i) {
- gid_t *groups = current->groups;
- do {
- if (*groups == grp)
- goto out;
- groups++;
- i--;
- } while (i);
- }
- return 0;
- }
-out:
- return 1;
-}
-
/*
* This should really be a blocking read-write lock
* rather than a semaphore. Anybody want to implement
diff -Naur -X ../../../exclude-files ./sysctl.c ../../orig/kernel/sysctl.c
--- ./sysctl.c Tue Dec 7 20:11:00 1999
+++ ../../orig/kernel/sysctl.c Tue Dec 7 00:41:12 1999
@@ -354,6 +354,26 @@
return error;
}

+/* Like in_group_p, but testing against egid, not fsgid */
+int in_egroup_p(gid_t grp)
+{
+ if (grp != current->egid) {
+ int i = current->ngroups;
+ if (i) {
+ gid_t *groups = current->groups;
+ do {
+ if (*groups == grp)
+ goto out;
+ groups++;
+ i--;
+ } while (i);
+ }
+ return 0;
+ }
+out:
+ return 1;
+}
+
/* ctl_perm does NOT grant the superuser all rights automatically, because
some sysctl variables are readonly even to root. */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/