groff-commit
[Top][All Lists]
Advanced

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

[groff] 10/18: [grohtml]: Quieten `-Wunused-result` warning.


From: G. Branden Robinson
Subject: [groff] 10/18: [grohtml]: Quieten `-Wunused-result` warning.
Date: Sun, 2 Jan 2022 10:33:58 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 8f9d3f2c88cc1fdf787c0638abb99e2cefd13e64
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Dec 31 08:03:44 2021 +1100

    [grohtml]: Quieten `-Wunused-result` warning.
    
    * src/devices/grohtml/post-html.cpp (html_printer::do_file_components):
      Emit fatal diagnostic if we're unable to `freopen()` standard output.
      Quietens `-Wunused-result` warning from GCC 8.3.
---
 ChangeLog                         | 7 +++++++
 src/devices/grohtml/post-html.cpp | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 5b8b9d24..def0b5f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-12-31  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grohtml/post-html.cpp
+       (html_printer::do_file_components): Emit fatal diagnostic if
+       we're unable to `freopen()` standard output.  Quietens
+       `-Wunused-result` warning from GCC 8.3.
+
 2021-12-31  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/grohtml/html.h (INT_HEXDIGITS): Add new constant
diff --git a/src/devices/grohtml/post-html.cpp 
b/src/devices/grohtml/post-html.cpp
index 0d8b21f1..a1018e19 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -5005,7 +5005,10 @@ void html_printer::do_file_components (void)
       string split_file = file_list.file_name();
       split_file += '\0';
       fflush(stdout);
-      freopen(split_file.contents(), "w", stdout);
+      if (!freopen(split_file.contents(), "w", stdout)) {
+       fatal("unable to reopen standard output stream: %1",
+             strerror(errno));
+      }
       fragment_no++;
       if (dialect == xhtml)
        writeHeadMetaStyle();



reply via email to

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