summaryrefslogtreecommitdiff
path: root/games/trek/dumpgame.c
diff options
context:
space:
mode:
Diffstat (limited to 'games/trek/dumpgame.c')
-rw-r--r--games/trek/dumpgame.c9
1 files changed, 5 insertions, 4 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);
}