groff-commit
[Top][All Lists]
Advanced

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

[groff] 20/80: [pre-grohtml]: Fix noisy error message.


From: G. Branden Robinson
Subject: [groff] 20/80: [pre-grohtml]: Fix noisy error message.
Date: Sat, 30 Nov 2024 04:02:15 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 184d1b3f950398aae45eef49676b721aeeae2b15
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 27 05:20:26 2024 -0600

    [pre-grohtml]: Fix noisy error message.
    
    * src/preproc/html/pre-html.cpp (do_file): Nullify `current_filename` on
      failure to open file.  Fixes noise in error message.
    
    Before:
    
    $ ./build/pre-grohtml nonexistent
    ./build/pre-grohtml:nonexistent: error: unable to open 'nonexistent': No 
such file or directory
    
    After:
    
    $ ./build/pre-grohtml nonexistent
    ./build/pre-grohtml: error: unable to open 'nonexistent': No such file or 
directory
---
 ChangeLog                     | 6 ++++++
 src/preproc/html/pre-html.cpp | 1 +
 2 files changed, 7 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 862ee14e3..49223db57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-11-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/html/pre-html.cpp (do_file): Nullify
+       `current_filename` on failure to open file.  Fixes noise in
+       error message.
+
 2024-11-27  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [grohtml]: Rename the `-U` option provided by Takuji to `-k`,
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index a3b933406..6a35e8158 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -1777,6 +1777,7 @@ static bool do_file(const char *filename)
   else {
     fp = fopen(filename, "r");
     if (0 /* nullptr*/ == fp) {
+      current_filename = 0 /* nullptr */;
       error("unable to open '%1': %2", filename, strerror(errno));
       return false;
     }



reply via email to

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