diff options
author | jsm <jsm@NetBSD.org> | 2004-01-01 16:03:46 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 2004-01-01 16:03:46 +0000 |
commit | b7a44a904f68d5a88886d63c2abc4cb42f2ac56c (patch) | |
tree | 38754a6fd711e89476e4f7541b91dd49ace527d6 /phantasia/main.c | |
parent | e404ad4403123e9253916916a4ec87e4fc5c11b8 (diff) | |
download | bsdgames-darwin-b7a44a904f68d5a88886d63c2abc4cb42f2ac56c.tar.gz bsdgames-darwin-b7a44a904f68d5a88886d63c2abc4cb42f2ac56c.tar.zst bsdgames-darwin-b7a44a904f68d5a88886d63c2abc4cb42f2ac56c.zip |
When cleaning up, only close files that have been opened successfully.
When reporting errors for failing to open files, give error text
rather than errno number. Patch from Joey Hess <joey@kitenet.net> for
Debian bug 187251 from Mikael Hedin <micce@debian.org>.
Diffstat (limited to 'phantasia/main.c')
-rw-r--r-- | phantasia/main.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/phantasia/main.c b/phantasia/main.c index 871ff678..f9beea8a 100644 --- a/phantasia/main.c +++ b/phantasia/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.11 2003/05/08 13:03:49 wiz Exp $ */ +/* $NetBSD: main.c,v 1.12 2004/01/01 16:03:46 jsm Exp $ */ /* * Phantasia 3.3.2 -- Interterminal fantasy game @@ -997,10 +997,14 @@ cleanup(doexit) nocbreak(); endwin(); } - fclose(Playersfp); - fclose(Monstfp); - fclose(Messagefp); - fclose(Energyvoidfp); + if (Playersfp) + fclose(Playersfp); + if (Monstfp) + fclose(Monstfp); + if (Messagefp) + fclose(Messagefp); + if (Energyvoidfp) + fclose(Energyvoidfp); if (doexit) exit(0); |