summaryrefslogtreecommitdiffstats
path: root/games/cribbage
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1997-09-01 00:34:51 +0000
committereivind <eivind@FreeBSD.org>1997-09-01 00:34:51 +0000
commitd8e95d8c1a6a0918fc9dda2ca247833ad222696d (patch)
tree42fed91af49ba9290d473dbe68d13f3f33e7545c /games/cribbage
parentff4b4c1d18cef70a372542d0a1a7a48e6543cf9e (diff)
downloadFreeBSD-src-d8e95d8c1a6a0918fc9dda2ca247833ad222696d.zip
FreeBSD-src-d8e95d8c1a6a0918fc9dda2ca247833ad222696d.tar.gz
Change games from setuid games to setgid games.
Reviewed by: maybe@yes.no Obtained from: OpenBSD (mostly deraadt@openbsd.org)
Diffstat (limited to 'games/cribbage')
-rw-r--r--games/cribbage/crib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/games/cribbage/crib.c b/games/cribbage/crib.c
index 16233ae..bc55c11 100644
--- a/games/cribbage/crib.c
+++ b/games/cribbage/crib.c
@@ -60,6 +60,10 @@ main(argc, argv)
BOOLEAN playing;
FILE *f;
int ch;
+ gid_t egid;
+
+ egid = getegid();
+ setegid(getgid());
while ((ch = getopt(argc, argv, "eqr")) != EOF)
switch (ch) {
@@ -120,11 +124,13 @@ main(argc, argv)
playing = (getuchar() == 'Y');
} while (playing);
+ setegid(egid);
if (f = fopen(_PATH_LOG, "a")) {
(void)fprintf(f, "%s: won %5.5d, lost %5.5d\n",
getlogin(), cgames, pgames);
(void) fclose(f);
}
+ setegid(getgid());
bye();
if (!f) {
(void) fprintf(stderr, "\ncribbage: can't open %s.\n",
OpenPOWER on IntegriCloud