1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

Beforeinstall log and score files to prevent owning of them by first

user who run game
Slightly modify game to understand pre-created score file
This commit is contained in:
Andrey A. Chernov 1997-09-24 01:27:26 +00:00
parent 54779e613a
commit 09b0f76735
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29756
3 changed files with 9 additions and 1 deletions

View File

@ -65,5 +65,9 @@ beforeinstall:
(cd ${.CURDIR}/datfiles; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} \
-m ${NOBINMODE} larnmaze larnopts larn.help \
${DESTDIR}${SHAREDIR}/games/larn)
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 660 /dev/null \
${DESTDIR}/var/games/larn/lscore12.0
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 660 /dev/null \
${DESTDIR}/var/games/larn/llog12.0
.include <bsd.prog.mk>

View File

@ -153,6 +153,8 @@ Noah Morgan
.Bl -tag -width "/var/games/larn/lscore12.0" -compact
.It Pa /var/games/larn/lscore12.0
Score file.
.It Pa /var/games/larn/llog12.0
Log file.
.It Pa ~/.larnopts
Options file.
.El

View File

@ -1,5 +1,6 @@
/* main.c */
#include <sys/types.h>
#include <sys/stat.h>
#include "header.h"
#include <pwd.h>
static char copyright[]="\nLarn is copyrighted 1986 by Noah Morgan.\n";
@ -41,6 +42,7 @@ main(argc,argv)
int hard;
char *ptr=0,*ttype;
struct passwd *pwe;
struct stat sb;
/*
* first task is to identify the player
@ -98,7 +100,7 @@ main(argc,argv)
/*
* now make scoreboard if it is not there (don't clear)
*/
if (access(scorefile,0) == -1) /* not there */
if (stat(scorefile,&sb) < 0 || sb.st_size == 0) /* not there */
makeboard();
/*