summaryrefslogtreecommitdiffstats
path: root/sail/misc.c
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>2000-02-09 22:27:55 +0000
committerjsm <jsm@NetBSD.org>2000-02-09 22:27:55 +0000
commit6a2a60db41cc5b3db833740e9381e58f5270a775 (patch)
tree2437ba95f91b7f0cdaa57157b4588f68a0e652f4 /sail/misc.c
parentdc6fb5dc49807bdfab1b64b687522b76a6492011 (diff)
downloadbsdgames-darwin-6a2a60db41cc5b3db833740e9381e58f5270a775.tar.gz
bsdgames-darwin-6a2a60db41cc5b3db833740e9381e58f5270a775.zip
Fix insecure /tmp usage in sail.
Essentially concludes the merge into NetBSD of those changes in the Linux port of the NetBSD games which it is fairly clear to me should be so merged.
Diffstat (limited to 'sail/misc.c')
-rw-r--r--sail/misc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sail/misc.c b/sail/misc.c
index c78e952f..3247cff7 100644
--- a/sail/misc.c
+++ b/sail/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.5 1997/10/13 19:44:38 christos Exp $ */
+/* $NetBSD: misc.c,v 1.6 2000/02/09 22:27:56 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: misc.c,v 1.5 1997/10/13 19:44:38 christos Exp $");
+__RCSID("$NetBSD: misc.c,v 1.6 2000/02/09 22:27:56 jsm Exp $");
#endif
#endif /* not lint */
@@ -208,8 +208,12 @@ struct ship *s;
float net;
struct logs *lp;
- if ((fp = fopen(_PATH_LOGFILE, "r+")) == NULL)
+ setegid(egid);
+ if ((fp = fopen(_PATH_LOGFILE, "r+")) == NULL) {
+ setegid(gid);
return;
+ }
+ setegid(gid);
#ifdef LOCK_EX
if (flock(fileno(fp), LOCK_EX) < 0)
return;