aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--migcom.c20
-rw-r--r--user.c4
3 files changed, 23 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index fca0af2..9ce336e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2006-01-26 Thomas Schwinge <tschwinge@gnu.org>
* config.guess: Updated from the canonical source.
diff --git a/migcom.c b/migcom.c
index db04455..40c274e 100644
--- a/migcom.c
+++ b/migcom.c
@@ -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));
+}
diff --git a/user.c b/user.c
index 374edbe..8d0a2ab 100644
--- a/user.c
+++ b/user.c
@@ -1320,7 +1320,9 @@ WriteUserIndividual(const statement_t *stats)
WriteRoutine(file, stat->stRoutine);
WriteEpilog(file);
- fclose(file);
+ if (ferror(file) || fclose(file))
+ fatal("fclose(): ", filename,
+ unix_error_string(errno));
strfree(filename);
}
break;