groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/12: [preconv]: Fix incorrect string handling.


From: G. Branden Robinson
Subject: [groff] 03/12: [preconv]: Fix incorrect string handling.
Date: Mon, 14 Oct 2024 06:20:14 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit a2216fe0c3e9a92501e6f9ded6e76e1e39eb16fc
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Oct 12 12:03:09 2024 -0500

    [preconv]: Fix incorrect string handling.
    
    * src/preproc/preconv/preconv.cpp (do_file): Fix incorrect handling of
      file name string (a post-groff 1.23.0 regression).
---
 ChangeLog                       |  5 +++++
 src/preproc/preconv/preconv.cpp | 12 ++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d4cb5c37d..221c3fa1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-12  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/preconv/preconv.cpp (do_file): Fix incorrect
+       handling of file name string (a post-groff 1.23.0 regression).
+
 2024-10-12  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        Rename some test scripts for clarity.
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index cc661c525..cbd9adae1 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -1105,13 +1105,17 @@ do_file(const char *filename)
     fp = fopen(filename, FOPEN_RB);
     reported_filename = "'" + string(filename) + "'";
   }
+  char *c_reported_filename = reported_filename.extract();
   if (!fp) {
-    error("can't open %1: %2", reported_filename.contents(),
-         strerror(errno));
+    error("can't open %1: %2", c_reported_filename, strerror(errno));
+    free(c_reported_filename);
     return 0;
   }
-  if (is_debugging)
-    fprintf(stderr, "processing %s\n", reported_filename.contents());
+  if (is_debugging) {
+    fprintf(stderr, "processing %s\n", c_reported_filename);
+    fflush(stderr);
+  }
+  free(c_reported_filename);
   if (fseek(fp, 0L, SEEK_SET) == 0)
     is_seekable = true;
   else {



reply via email to

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