Skip to content

Commit dd34f9e

Browse files
give up setuid-ness. we don't need it. while i'm here, include
<sys/signal.h> and use SIGINT rather than 2.
1 parent 5bdb157 commit dd34f9e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

games/adventure/init.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: init.c,v 1.2 1995/03/21 12:05:04 cgd Exp $ */
1+
/* $NetBSD: init.c,v 1.3 1996/05/21 10:48:09 mrg Exp $ */
22

33
/*-
44
* Copyright (c) 1993
@@ -42,13 +42,14 @@
4242
#if 0
4343
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93";
4444
#else
45-
static char rcsid[] = "$NetBSD: init.c,v 1.2 1995/03/21 12:05:04 cgd Exp $";
45+
static char rcsid[] = "$NetBSD: init.c,v 1.3 1996/05/21 10:48:09 mrg Exp $";
4646
#endif
4747
#endif /* not lint */
4848

4949
/* Re-coding of advent in C: data initialization */
5050

5151
#include <sys/types.h>
52+
#include <sys/signal.h>
5253
#include <stdio.h>
5354
#include "hdr.h"
5455

@@ -203,7 +204,7 @@ linkdata() /* secondary data manipulation */
203204

204205
trapdel() /* come here if he hits a del */
205206
{ delhit++; /* main checks, treats as QUIT */
206-
signal(2,trapdel); /* catch subsequent DELs */
207+
signal(SIGINT,trapdel); /* catch subsequent DELs */
207208
}
208209

209210

games/adventure/main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: main.c,v 1.3 1996/02/06 22:47:06 jtc Exp $ */
1+
/* $NetBSD: main.c,v 1.4 1996/05/21 10:48:07 mrg Exp $ */
22

33
/*-
44
* Copyright (c) 1991, 1993
@@ -48,17 +48,17 @@ static char copyright[] =
4848
#if 0
4949
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
5050
#else
51-
static char rcsid[] = "$NetBSD: main.c,v 1.3 1996/02/06 22:47:06 jtc Exp $";
51+
static char rcsid[] = "$NetBSD: main.c,v 1.4 1996/05/21 10:48:07 mrg Exp $";
5252
#endif
5353
#endif /* not lint */
5454

5555
/* Re-coding of advent in C: main program */
5656

5757
#include <sys/file.h>
58+
#include <sys/signal.h>
5859
#include <stdio.h>
5960
#include "hdr.h"
6061

61-
6262
main(argc,argv)
6363
int argc;
6464
char **argv;
@@ -68,8 +68,12 @@ char **argv;
6868
struct text *kk;
6969
extern trapdel();
7070

71+
/* adventure doesn't need setuid-ness, so, just get rid of it */
72+
if (setuid(getuid()) < 0)
73+
perror("setuid");
74+
7175
init(); /* Initialize everything */
72-
signal(2,trapdel);
76+
signal(SIGINT,trapdel);
7377

7478
if (argc > 1) /* Restore file specified */
7579
{ /* Restart is label 8305 (Fortran) */

0 commit comments

Comments
 (0)