Eric Blake wrote :
According to Jean-Charles Longuet on 5/21/2008 2:10 PM:
|
| When m4 fails to open() the frozen state file, it complains
| but the process exit code is still 0. However, the same function
| may trigger failures leading to a non-zero process exit code,
| for example when the close() of the frozen state file fails.
Thanks for the report. Which version of m4 was this against? I'm
guessing this was against a release tarball, rather than the current git
repository, since this area of code has changed in the meantime?
As you stated, this was against release 1.4.11.
I had a look in the git repository, and the open() case seem to handle
errors. However, there are no checks on flose() return value in
produce_frozen_state(). Not sure if you already worked on it. If not,
this short patch may help. I was wondering if fputs() calls required
their return code to be also checked, but I didn't add that in this
one...
diff --git a/src/freeze.c b/src/freeze.c
index d32fc9e..3bb5db9 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -326,7 +326,8 @@ produce_frozen_state (m4 *context, const char *name)
/* All done. */
fputs ("# End of frozen state file\n", file);
- fclose (file);
+ if (!fclose(file))
+ m4_error (context, 0, errno, NULL, _("cannot close `%s'"), name);
}
/* Issue a message saying that some character is an EXPECTED character. */