m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoid fopen bugs


From: Eric Blake
Subject: Re: avoid fopen bugs
Date: Thu, 25 Sep 2008 20:01:12 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 9/24/2008 10:16 PM:
> In both cases, mingw does not use the typical errno value.  So I had to
> modify the testsuite to allow ignoring stderr, so as to avoid failures
> from the difference in strerror output.

In the process of porting that patch to master, I noticed that the error
messages were not printed consistently.  Committing this:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjcQmgACgkQ84KuGfSFAYCGeQCfUrSXS+iBU3kVfecsGT8EEcIj
x2EAoMZsxjtROQ0wmRTeMdFvkm2KVrVR
=cg2o
-----END PGP SIGNATURE-----
>From 5116db0fcd37e4480062b4819dca17a98a7890d7 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 25 Sep 2008 06:32:26 -0600
Subject: [PATCH] Tweak error message on command line failure.

* src/m4.c (process_file): Match wording of include builtin.
* src/freeze.c (produce_frozen_state): Likewise.
* m4/gnulib-cache.m4: Regenerate.
* doc/m4.texinfo (Command line files, Using frozen files): Update
tests accordingly.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog          |    9 +++++++++
 doc/m4.texinfo     |    4 ++--
 m4/gnulib-cache.m4 |    2 +-
 src/freeze.c       |    2 +-
 src/m4.c           |    2 +-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b2e6b57..c6d3b67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-25  Eric Blake  <address@hidden>
+
+       Tweak error message on command line failure.
+       * src/m4.c (process_file): Match wording of include builtin.
+       * src/freeze.c (produce_frozen_state): Likewise.
+       * m4/gnulib-cache.m4: Regenerate.
+       * doc/m4.texinfo (Command line files, Using frozen files): Update
+       tests accordingly.
+
 2008-09-24  Eric Blake  <address@hidden>
 
        Unify error handling for reading directories.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 6fcd9f3..940bd9c 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -934,7 +934,7 @@ Command line files
 @comment xerr: ignore
 @comment options: Makefile/
 @example
address@hidden: Makefile/: Not a directory
address@hidden: cannot open `Makefile/': Not a directory
 @end example
 @end ignore
 
@@ -6843,7 +6843,7 @@ Using frozen files
 @example
 $ @kbd{m4 -F /none/such}
 ^D
address@hidden: cannot open /none/such: No such file or directory
address@hidden: cannot open `/none/such': No such file or directory
 @end example
 @end ignore
 
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 96864de..f6cc1ac 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 
--source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests 
--no-libtool --macro-prefix=M4 announce-gen assert autobuild avltree-oset 
binary-io c-stack clean-temp cloexec close-stream closein config-h dirname 
error fdl fflush filenamecat fopen fopen-safer fseeko gendocs getopt 
git-version-gen gnumakefile gnupload gpl-3.0 intprops mkstemp obstack progname 
regex sigaction stdbool stdint stdlib-safer strsignal strstr strtod strtol 
unlocked-io verror version-etc version-etc-fsf xalloc xprintf xvasprintf-posix
+#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --with-tests --no-libtool --macro-prefix=M4 announce-gen 
assert autobuild avltree-oset binary-io c-stack clean-temp cloexec close-stream 
closein config-h dirname error fdl fflush filenamecat fopen fopen-safer fseeko 
gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 intprops mkstemp 
obstack progname regex sigaction stdbool stdint stdlib-safer strsignal strstr 
strtod strtol unlocked-io verror version-etc version-etc-fsf xalloc xprintf 
xvasprintf-posix
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([local])
diff --git a/src/freeze.c b/src/freeze.c
index 2a7ff30..ddc2e08 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -59,7 +59,7 @@ produce_frozen_state (const char *name)
   file = fopen (name, O_BINARY ? "wb" : "w");
   if (!file)
     {
-      M4ERROR ((EXIT_FAILURE, errno, "cannot open %s", name));
+      M4ERROR ((EXIT_FAILURE, errno, "cannot open `%s'", name));
       return;
     }
 
diff --git a/src/m4.c b/src/m4.c
index ee0fe8a..a414086 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -332,7 +332,7 @@ process_file (const char *name)
       FILE *fp = m4_path_search (name, &full_name);
       if (fp == NULL)
        {
-         error (0, errno, "%s", name);
+         error (0, errno, "cannot open `%s'", name);
          /* Set the status to EXIT_FAILURE, even though we
             continue to process files after a missing file.  */
          retcode = EXIT_FAILURE;
-- 
1.6.0.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]