From 6a2a60db41cc5b3db833740e9381e58f5270a775 Mon Sep 17 00:00:00 2001 From: jsm Date: Wed, 9 Feb 2000 22:27:55 +0000 Subject: 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. --- sail/misc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sail/misc.c') 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; -- cgit v1.2.3