diff options
author | Thomas Schwinge <tschwinge@gnu.org> | 2006-07-28 23:55:25 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2006-07-28 23:55:25 +0000 |
commit | 297dd55afd2bf2bedbdb244fba4e9027b8060532 (patch) | |
tree | 067b757343dae8af82ff5f6afaba9fa0dce6d1b6 /migcom.c | |
parent | cfc0bb3b0de0e1d5f96ba2b600babb2f19ce0922 (diff) | |
download | mig-297dd55afd2bf2bedbdb244fba4e9027b8060532.tar.gz mig-297dd55afd2bf2bedbdb244fba4e9027b8060532.tar.bz2 mig-297dd55afd2bf2bedbdb244fba4e9027b8060532.zip |
2006-07-29 Ognyan Kulev <ogi@fmi.uni-sofia.bg>
* migcom.c (myfclose): New function.
(main): Use myfclose instead of fclose.
* user.c (WriteUserIndividual): Check for errors when closing file.
Diffstat (limited to 'migcom.c')
-rw-r--r-- | migcom.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -79,6 +79,7 @@ extern int yyparse(); static FILE *myfopen(const char *name, const char *mode); +static void myfclose(FILE *file, const char *name); static string_t RoutineListFileName; @@ -239,7 +240,7 @@ main(int argc, char **argv) fflush(stdout); } WriteUserHeader(uheader, StatementList); - fclose(uheader); + myfclose(uheader, UserHeaderFileName); if (ServerHeaderFileName) { if (BeVerbose) @@ -248,7 +249,7 @@ main(int argc, char **argv) fflush (stdout); } WriteServerHeader(sheader, StatementList); - fclose(sheader); + myfclose(sheader, ServerHeaderFileName); } if (IsKernelServer) { @@ -258,7 +259,7 @@ main(int argc, char **argv) fflush(stdout); } WriteInternalHeader(iheader, StatementList); - fclose(iheader); + myfclose(iheader, InternalHeaderFileName); } if (UserFilePrefix) { @@ -277,7 +278,7 @@ main(int argc, char **argv) fflush(stdout); } WriteUser(user, StatementList); - fclose(user); + myfclose(user, UserFileName); } if (BeVerbose) { @@ -285,13 +286,13 @@ main(int argc, char **argv) fflush(stdout); } WriteServer(server, StatementList); - fclose(server); + myfclose(server, ServerFileName); if (RoutineListFileName != strNULL) { FILE *listfile = myfopen (RoutineListFileName, "w"); WriteRoutineList (listfile, StatementList); - fclose (listfile); + myfclose (listfile, RoutineListFileName); } if (BeVerbose) @@ -318,3 +319,10 @@ myfopen(const char *name, const char *mode) return file; } + +static void +myfclose(FILE *file, const char *name) +{ + if (ferror(file) || fclose(file)) + fatal("fclose(): ", name, unix_error_string(errno)); +} |