]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - adventure/save.c
backout previous (arc4random), per request from sommerfeld
[bsdgames-darwin.git] / adventure / save.c
index c2dc9215ff5a15e89cf23a90b49451f60449e8bf..71b9e78f4092253ea345e0000e2eae99912187cc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: save.c,v 1.5 1998/09/13 00:07:24 hubertf Exp $ */
+/*     $NetBSD: save.c,v 1.7 1999/07/17 20:02:48 hubertf Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
 #if 0
 static char sccsid[] = "@(#)save.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: save.c,v 1.5 1998/09/13 00:07:24 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"
@@ -95,7 +96,7 @@ struct savestruct save_array[] =
        {&oldlc2, sizeof(oldlc2)},
        {&oldloc, sizeof(oldloc)},
        {&panic, sizeof(panic)},
-       {&saved, sizeof(saved)},
+       {&saveday, sizeof(saveday)},
        {&savet, sizeof(savet)},
        {&scorng, sizeof(scorng)},
        {&spk, sizeof(spk)},
@@ -152,7 +153,10 @@ save(outfile)                      /* Two passes on data: first to get checksum,
                        *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;
 }