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()
This commit is contained in:
Andrey A. Chernov 1997-09-24 02:56:53 +00:00
parent 03e00a72c6
commit e795ad69b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29760
3 changed files with 8 additions and 6 deletions

View File

@ -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>

View File

@ -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

View File

@ -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 (;;) {