Source-Changes-HG archive

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

[src/trunk]: src/games/adventure Adventure(6) should check for errors (e.g. d...



details:   https://anonhg.NetBSD.org/src/rev/04dd52f13fa5
branches:  trunk
changeset: 474734:04dd52f13fa5
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Sat Jul 17 20:02:48 1999 +0000

description:
Adventure(6) should check for errors (e.g. disk full or quota
exceeded) when writing out saved games. Do so!

Patch supplied by Joseph Myers <jsm28%cam.ac.uk@localhost> in PR 8016

diffstat:

 games/adventure/save.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 431aa31f22ad -r 04dd52f13fa5 games/adventure/save.c
--- a/games/adventure/save.c    Sat Jul 17 19:57:03 1999 +0000
+++ b/games/adventure/save.c    Sat Jul 17 20:02:48 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: save.c,v 1.6 1999/07/16 01:38:20 hubertf Exp $ */
+/*     $NetBSD: save.c,v 1.7 1999/07/17 20:02:48 hubertf Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -43,10 +43,11 @@
 #if 0
 static char sccsid[] = "@(#)save.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: save.c,v 1.6 1999/07/16 01:38:20 hubertf Exp $");
+__RCSID("$NetBSD: save.c,v 1.7 1999/07/17 20:02:48 hubertf Exp $");
 #endif
 #endif                         /* not lint */
 
+#include <err.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include "hdr.h"
@@ -152,7 +153,10 @@
                        *s = (*s ^ random()) & 0xFF;    /* Lightly encrypt */
                fwrite(p->address, p->width, 1, out);
        }
-       fclose(out);
+       if (fclose(out) != 0) {
+               warn("writing %s", outfile);
+               return 1;
+       }
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index