summaryrefslogtreecommitdiffstats
path: root/games/larn
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-09-24 01:27:26 +0000
committerache <ache@FreeBSD.org>1997-09-24 01:27:26 +0000
commit0d91fed910f0a476a99075a11766437d070ae244 (patch)
tree5ca37394819fceef42745265e57359344ca2b390 /games/larn
parentca54550bb7e50eb25c4f44e242c79153e0f91ed8 (diff)
downloadFreeBSD-src-0d91fed910f0a476a99075a11766437d070ae244.zip
FreeBSD-src-0d91fed910f0a476a99075a11766437d070ae244.tar.gz
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
Diffstat (limited to 'games/larn')
-rw-r--r--games/larn/Makefile4
-rw-r--r--games/larn/larn.62
-rw-r--r--games/larn/main.c4
3 files changed, 9 insertions, 1 deletions
diff --git a/games/larn/Makefile b/games/larn/Makefile
index 12280cd..b31c431 100644
--- a/games/larn/Makefile
+++ b/games/larn/Makefile
@@ -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>
diff --git a/games/larn/larn.6 b/games/larn/larn.6
index e64ee6f..3734aa8 100644
--- a/games/larn/larn.6
+++ b/games/larn/larn.6
@@ -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
diff --git a/games/larn/main.c b/games/larn/main.c
index d75ee9b..2889625 100644
--- a/games/larn/main.c
+++ b/games/larn/main.c
@@ -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();
/*
OpenPOWER on IntegriCloud