summaryrefslogtreecommitdiff
path: root/games/trek
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2006-03-27 00:10:16 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2006-03-27 00:10:16 +0000
commit1e83c82a3bf562241906e89f69222dfa40422206 (patch)
tree3cb64e8eb5d6a8755f5b2b2f0f18285a9094a131 /games/trek
parent8865bd2a63b0dd63bb6398ca8fef60e3f5669d34 (diff)
assorted fixes mostly from coverity via netbsd via jasper adriaanse via tech
Diffstat (limited to 'games/trek')
-rw-r--r--games/trek/dumpgame.c9
-rw-r--r--games/trek/schedule.c6
2 files changed, 8 insertions, 7 deletions
diff --git a/games/trek/dumpgame.c b/games/trek/dumpgame.c
index 45ada426cc3..511ebdaf7e2 100644
--- a/games/trek/dumpgame.c
+++ b/games/trek/dumpgame.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dumpgame.c,v 1.7 2003/06/03 03:01:41 millert Exp $ */
+/* $OpenBSD: dumpgame.c,v 1.8 2006/03/27 00:10:15 tedu Exp $ */
/* $NetBSD: dumpgame.c,v 1.4 1995/04/24 12:25:54 cgd Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: dumpgame.c,v 1.7 2003/06/03 03:01:41 millert Exp $";
+static char rcsid[] = "$OpenBSD: dumpgame.c,v 1.8 2006/03/27 00:10:15 tedu Exp $";
#endif
#endif /* not lint */
@@ -125,13 +125,14 @@ restartgame()
{
int fd, version;
- if ((fd = open("trek.dump", O_RDONLY)) < 0 ||
+ if ((fd = open("trek.dump", O_RDONLY)) == -1 ||
read(fd, &version, sizeof version) != sizeof version ||
version != VERSION ||
readdump(fd))
{
printf("cannot restart\n");
- close(fd);
+ if (fd != -1)
+ close(fd);
return (1);
}
diff --git a/games/trek/schedule.c b/games/trek/schedule.c
index efa5804cde4..09f53867f9f 100644
--- a/games/trek/schedule.c
+++ b/games/trek/schedule.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: schedule.c,v 1.4 2003/06/03 03:01:42 millert Exp $ */
+/* $OpenBSD: schedule.c,v 1.5 2006/03/27 00:10:15 tedu Exp $ */
/* $NetBSD: schedule.c,v 1.3 1995/04/22 10:59:23 cgd Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)schedule.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: schedule.c,v 1.4 2003/06/03 03:01:42 millert Exp $";
+static char rcsid[] = "$OpenBSD: schedule.c,v 1.5 2006/03/27 00:10:15 tedu Exp $";
#endif
#endif /* not lint */
@@ -81,7 +81,7 @@ schedule(type, offset, x, y, z)
e->x = x;
e->y = y;
e->systemname = z;
- Now.eventptr[type] = e;
+ Now.eventptr[type & E_EVENT] = e;
return (e);
}
errx(1, "Cannot schedule event %d parm %d %d %d", type, x, y, z);