summaryrefslogtreecommitdiffstats
path: root/games/canfield
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-09-24 02:56:53 +0000
committerache <ache@FreeBSD.org>1997-09-24 02:56:53 +0000
commitd6530ba40d9771bd76656602debadbc1c34f5883 (patch)
tree88a4e0d45dca5617b07a77057189535502dcda4d /games/canfield
parent57eb2ca27ae0db0529c08d313a97117ed75cd0f8 (diff)
downloadFreeBSD-src-d6530ba40d9771bd76656602debadbc1c34f5883.zip
FreeBSD-src-d6530ba40d9771bd76656602debadbc1c34f5883.tar.gz
Pre-create score file to prevent it owned by first user who run
canfield Fix scorefile name in manpage Use srandomdev Remove revoke, the game already revoked in another place Fix bug with missing getuid()
Diffstat (limited to 'games/canfield')
-rw-r--r--games/canfield/canfield/Makefile3
-rw-r--r--games/canfield/canfield/canfield.62
-rw-r--r--games/canfield/canfield/canfield.c9
3 files changed, 8 insertions, 6 deletions
diff --git a/games/canfield/canfield/Makefile b/games/canfield/canfield/Makefile
index 7b60e29..a3b3a7c 100644
--- a/games/canfield/canfield/Makefile
+++ b/games/canfield/canfield/Makefile
@@ -7,6 +7,9 @@ LDADD= -lcurses -ltermcap -lcompat
HIDEGAME=hidegame
MLINKS= canfield.6 cfscores.6
+beforeinstall:
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
+ ${DESTDIR}/var/games/cfscores
.include "../../Makefile.inc"
.include <bsd.prog.mk>
diff --git a/games/canfield/canfield/canfield.6 b/games/canfield/canfield/canfield.6
index 2670f73..dcf5fc1 100644
--- a/games/canfield/canfield/canfield.6
+++ b/games/canfield/canfield/canfield.6
@@ -108,7 +108,7 @@ played the game since the database was set up.
.br
/usr/games/cfscores the database printer
.br
-/usr/games/lib/cfscores the database of scores
+/var/games/cfscores the database of scores
.SH BUGS
It is impossible to cheat.
.SH AUTHORS
diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c
index f13fed6..5380434 100644
--- a/games/canfield/canfield/canfield.c
+++ b/games/canfield/canfield/canfield.c
@@ -58,6 +58,8 @@ static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93";
#include <ctype.h>
#include <signal.h>
#include <termios.h>
+#include <unistd.h>
+#include <stdlib.h>
#include "pathnames.h"
@@ -1567,9 +1569,10 @@ initall()
{
int i;
- srandom(getpid());
+ srandomdev();
time(&acctstart);
initdeck(deck);
+ uid = getuid();
if (uid < 0)
uid = 0;
dbfd = open(_PATH_SCORE, 2);
@@ -1692,10 +1695,6 @@ main(argc, argv)
noecho();
initall();
- /* revoke privs */
- setegid(getgid());
- setgid(getgid());
-
instruct();
makeboard();
for (;;) {
OpenPOWER on IntegriCloud