summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1999-02-10 00:29:21 +0000
committerhubertf <hubertf@NetBSD.org>1999-02-10 00:29:21 +0000
commite0e186091a777dfe9cf3c22deeff989f459d8db9 (patch)
treef28a15fe571fc35e9f50726951538e946868c3b2
parent638c095d5cf47282d99189e1425435a0763a369b (diff)
downloadbsdgames-darwin-e0e186091a777dfe9cf3c22deeff989f459d8db9.tar.gz
bsdgames-darwin-e0e186091a777dfe9cf3c22deeff989f459d8db9.tar.zst
bsdgames-darwin-e0e186091a777dfe9cf3c22deeff989f459d8db9.zip
The patch below does some minor cleanup of adventure(6): an additional
use of const I missed in bin/6041; avoiding a signed/unsigned warning; marking an unused parameter as such; revoking setgid privileges (including the saved gid) rather than setuid ones; includes and function prototypes in setup.c; the string passed to err() should not end with a `.'. Together with the patch sent concerning adventure's EOF handling, this synchronises adventure(6) in NetBSD with the Linux port of the NetBSD games. Via PR 6557 by Joseph Myers <jsm28@cam.ac.uk>
-rw-r--r--adventure/crc.c8
-rw-r--r--adventure/main.c9
-rw-r--r--adventure/setup.c10
3 files changed, 15 insertions, 12 deletions
diff --git a/adventure/crc.c b/adventure/crc.c
index b80b1263..2e000992 100644
--- a/adventure/crc.c
+++ b/adventure/crc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: crc.c,v 1.6 1998/09/13 00:07:24 hubertf Exp $ */
+/* $NetBSD: crc.c,v 1.7 1999/02/10 00:29:21 hubertf Exp $ */
/*-
* Copyright (c) 1993
@@ -42,13 +42,13 @@
static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 5/31/93";
static char ORIGINAL_sccsid[] = "@(#)crc.c 5.2 (Berkeley) 4/4/91";
#else
-__RCSID("$NetBSD: crc.c,v 1.6 1998/09/13 00:07:24 hubertf Exp $");
+__RCSID("$NetBSD: crc.c,v 1.7 1999/02/10 00:29:21 hubertf Exp $");
#endif
#endif /* not lint */
#include "extern.h"
-unsigned long crctab[] = {
+const unsigned long crctab[] = {
0x7fffffff,
0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e,
@@ -111,7 +111,7 @@ unsigned long crctab[] = {
*/
unsigned long crcval;
-int step;
+unsigned int step;
void
crc_start()
diff --git a/adventure/main.c b/adventure/main.c
index e3112c12..aa21cf8c 100644
--- a/adventure/main.c
+++ b/adventure/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.12 1998/09/14 09:29:08 hubertf Exp $ */
+/* $NetBSD: main.c,v 1.13 1999/02/10 00:29:21 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
#else
-__RCSID("$NetBSD: main.c,v 1.12 1998/09/14 09:29:08 hubertf Exp $");
+__RCSID("$NetBSD: main.c,v 1.13 1999/02/10 00:29:21 hubertf Exp $");
#endif
#endif /* not lint */
@@ -73,9 +73,8 @@ main(argc, argv)
int rval, ll;
struct text *kk;
- /* adventure doesn't need setuid-ness, so, just get rid of it */
- if (setuid(getuid()) < 0)
- warn("setuid");
+ /* revoke setgid privileges from dm */
+ setregid(getgid(), getgid());
init(); /* Initialize everything */
signal(SIGINT, trapdel);
diff --git a/adventure/setup.c b/adventure/setup.c
index 71cff65c..89c3100a 100644
--- a/adventure/setup.c
+++ b/adventure/setup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.5 1998/09/13 15:23:40 hubertf Exp $ */
+/* $NetBSD: setup.c,v 1.6 1999/02/10 00:29:21 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: setup.c,v 1.5 1998/09/13 15:23:40 hubertf Exp $");
+__RCSID("$NetBSD: setup.c,v 1.6 1999/02/10 00:29:21 hubertf Exp $");
#endif
#endif /* not lint */
@@ -64,6 +64,8 @@ __RCSID("$NetBSD: setup.c,v 1.5 1998/09/13 15:23:40 hubertf Exp $");
#define SIG2 " * Sterday, 6 Thrimidge S.R. 1993, 15:24"
#include <stdio.h>
+#include <stdlib.h>
+#include <err.h>
#include "hdr.h" /* SEED lives in there; keep them coordinated. */
#define USAGE "Usage: setup file > data.c (file is typically glorkz)"
@@ -73,6 +75,8 @@ __RCSID("$NetBSD: setup.c,v 1.5 1998/09/13 15:23:40 hubertf Exp $");
#define LINE 10 /* How many values do we get on a line? */
+int main __P((int, char *[]));
+
int
main(argc, argv)
int argc;
@@ -85,7 +89,7 @@ main(argc, argv)
errx(1, USAGE);
if ((infile = fopen(argv[1], "r")) == NULL)
- err(1, "Can't read file %s.", argv[1]);
+ err(1, "Can't read file %s", argv[1]);
puts("/*\n * data.c: created by setup from the ascii data file.");
puts(SIG1);
puts(SIG2);