Subject: bin/8016: [PATCH] Adventure saved file handling
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm28@cam.ac.uk>
List: netbsd-bugs
Date: 07/17/1999 02:36:44
>Number: 8016
>Category: bin
>Synopsis: [PATCH] Adventure saved file handling
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 17 02:35:02 1999
>Last-Modified:
>Originator: Joseph S. Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release: NetBSD-current of 1999-07-16
>Environment:
[
System: Linux decomino 2.2.10 #1 Mon Jun 14 07:48:53 UTC 1999 i686 unknown
Architecture: i686
]
>Description:
Adventure(6) should check for errors (e.g. disk full or quota
exceeded) when writing out saved games.
>How-To-Repeat:
>Fix:
diff -ruN adventure/save.c adventure+/save.c
--- adventure/save.c Fri Jul 16 11:02:52 1999
+++ adventure+/save.c Fri Jul 16 21:41:49 1999
@@ -47,6 +47,7 @@
#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;
}
>Audit-Trail:
>Unformatted: