summaryrefslogtreecommitdiffstats
path: root/adventure
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1999-07-17 20:02:48 +0000
committerhubertf <hubertf@NetBSD.org>1999-07-17 20:02:48 +0000
commitc654f6306c2258caaeac67d83dbd770d17cc7561 (patch)
treeb97e2244acd981ba1bba807abc94cf8c40006df2 /adventure
parent3809a8fdebc7087514443871f875d64c9e24e447 (diff)
downloadbsdgames-darwin-c654f6306c2258caaeac67d83dbd770d17cc7561.tar.gz
bsdgames-darwin-c654f6306c2258caaeac67d83dbd770d17cc7561.tar.zst
bsdgames-darwin-c654f6306c2258caaeac67d83dbd770d17cc7561.zip
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> in PR 8016
Diffstat (limited to 'adventure')
-rw-r--r--adventure/save.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/adventure/save.c b/adventure/save.c
index 9f0e8d3a..71b9e78f 100644
--- a/adventure/save.c
+++ b/adventure/save.c
@@ -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 @@ 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;
}