diff options
author | jsm <jsm@NetBSD.org> | 1999-09-10 00:18:20 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 1999-09-10 00:18:20 +0000 |
commit | b9e9a125627944dbfaacf50922e58f4900e9c567 (patch) | |
tree | a8357b35169078e664f1e5fd90266ef0a0e662d0 /monop | |
parent | 517497ea9683bb0c3bb9a38d4b7930b325c9db03 (diff) | |
download | bsdgames-darwin-b9e9a125627944dbfaacf50922e58f4900e9c567.tar.gz bsdgames-darwin-b9e9a125627944dbfaacf50922e58f4900e9c567.tar.zst bsdgames-darwin-b9e9a125627944dbfaacf50922e58f4900e9c567.zip |
Check for write errors in auxiliary programs used during build of games.
Diffstat (limited to 'monop')
-rw-r--r-- | monop/initdeck.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/monop/initdeck.c b/monop/initdeck.c index a4b76b3e..9e5cd9b7 100644 --- a/monop/initdeck.c +++ b/monop/initdeck.c @@ -1,4 +1,4 @@ -/* $NetBSD: initdeck.c,v 1.10 1999/09/09 17:27:59 jsm Exp $ */ +/* $NetBSD: initdeck.c,v 1.11 1999/09/10 00:18:21 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)initdeck.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: initdeck.c,v 1.10 1999/09/09 17:27:59 jsm Exp $"); +__RCSID("$NetBSD: initdeck.c,v 1.11 1999/09/10 00:18:21 jsm Exp $"); #endif #endif /* not lint */ @@ -105,10 +105,8 @@ main(ac, av) if (CC_D.offsets == NULL || CH_D.offsets == NULL) errx(1, "out of memory"); fseek(inf, 0L, SEEK_SET); - if ((outf = fopen(outfile, "w")) == NULL) { - perror(outfile); - exit(0); - } + if ((outf = fopen(outfile, "w")) == NULL) + err(1, "fopen %s", outfile); /* * these fields will be overwritten after the offsets are calculated, @@ -143,6 +141,9 @@ main(ac, av) fwrite(CC_D.offsets, sizeof (off_t), CC_D.num_cards, outf); fwrite(CH_D.offsets, sizeof (off_t), CH_D.num_cards, outf); + fflush(outf); + if (ferror(outf)) + err(1, "fwrite %s", outfile); fclose(outf); printf("There were %d com. chest and %d chance cards\n", CC_D.num_cards, CH_D.num_cards); |