Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games A couple more checks for file descriptor < 3 missed ea...



details:   https://anonhg.NetBSD.org/src/rev/7b521afcbc44
branches:  trunk
changeset: 476319:7b521afcbc44
user:      jsm <jsm%NetBSD.org@localhost>
date:      Mon Sep 13 17:15:42 1999 +0000

description:
A couple more checks for file descriptor < 3 missed earlier.

diffstat:

 games/battlestar/com6.c |  6 ++++--
 games/phantasia/main.c  |  4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 6780da99c47c -r 7b521afcbc44 games/battlestar/com6.c
--- a/games/battlestar/com6.c   Mon Sep 13 17:14:42 1999 +0000
+++ b/games/battlestar/com6.c   Mon Sep 13 17:15:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com6.c,v 1.12 1999/09/08 21:45:25 jsm Exp $    */
+/*     $NetBSD: com6.c,v 1.13 1999/09/13 17:15:42 jsm Exp $    */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)com6.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: com6.c,v 1.12 1999/09/08 21:45:25 jsm Exp $");
+__RCSID("$NetBSD: com6.c,v 1.13 1999/09/13 17:15:42 jsm Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -113,6 +113,8 @@
        score_fp = fopen(_PATH_SCORE, "a");
        if (score_fp == NULL)
                warn("open %s for append", _PATH_SCORE);
+       if (score_fp != NULL && fileno(score_fp) < 3)
+               exit(1);
 }
 
 void
diff -r 6780da99c47c -r 7b521afcbc44 games/phantasia/main.c
--- a/games/phantasia/main.c    Mon Sep 13 17:14:42 1999 +0000
+++ b/games/phantasia/main.c    Mon Sep 13 17:15:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.8 1999/09/08 21:57:19 jsm Exp $     */
+/*     $NetBSD: main.c,v 1.9 1999/09/13 17:15:43 jsm Exp $     */
 
 /*
  * Phantasia 3.3.2 -- Interterminal fantasy game
@@ -287,6 +287,8 @@
        if ((Playersfp = fopen(_PATH_PEOPLE, "r+")) == NULL)
                error(_PATH_PEOPLE);
        /* NOTREACHED */
+       if (fileno(Playersfp) < 3)
+               exit(1);
 
        if ((Monstfp = fopen(_PATH_MONST, "r+")) == NULL)
                error(_PATH_MONST);



Home | Main Index | Thread Index | Old Index