texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (file_erro


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (file_error_or_write_close): return -2 if the file stream is 0.
Date: Mon, 30 Sep 2024 18:40:49 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new d764fc0e96 * tp/Texinfo/XS/convert/convert_html.c 
(file_error_or_write_close): return -2 if the file stream is 0.
d764fc0e96 is described below

commit d764fc0e963e83de611dc26e9dd864e065029bf0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 24 08:21:50 2024 +0200

    * tp/Texinfo/XS/convert/convert_html.c (file_error_or_write_close):
    return -2 if the file stream is 0.
    
    * tp/Texinfo/XS/convert/convert_html.c (html_node_redirections): do
    not return an error immediately from the function in case of open
    error, as in Perl.
---
 ChangeLog                            | 9 +++++++++
 tp/Texinfo/Convert/HTML.pm           | 3 ++-
 tp/Texinfo/XS/convert/convert_html.c | 9 +++++++--
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fa3f11a695..0cf425c327 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,15 @@
        * tp/Texinfo/XS/convert/convert_html.c (do_js_files): use
        copy_file_to.
 
+2024-07-23  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (file_error_or_write_close):
+       return -2 if the file stream is 0.
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_node_redirections): do
+       not return an error immediately from the function in case of open
+       error, as in Perl.
+
 2024-07-23  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_do_jslicenses_file): check path before
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 494b6f739e..92d2d350d1 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -13271,7 +13271,7 @@ sub _node_redirections($$$$)
                              $self->output_files_information(), $self,
                              $encoded_out_filepath);
         if (!$file_fh) {
-         $self->converter_document_error(sprintf(__(
+          $self->converter_document_error(sprintf(__(
                                     "could not open %s for writing: %s"),
                                     $out_filepath, $error_message));
         } else {
@@ -13287,6 +13287,7 @@ sub _node_redirections($$$$)
           }
           $redirection_files_done++;
         }
+        # NOTE failure to open a file does not stop the processing
       }
     }
   }
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 20b999270a..4fb4fdc45b 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -20634,6 +20634,8 @@ html_prepare_title_titlepage (CONVERTER *self, const 
char *output_file,
   memset (&self->current_filename, 0, sizeof (FILE_NUMBER_NAME));
 }
 
+/* return 0 on success, -1 on write or close error, -2 if file_fh is 0,
+   which should mean a failure to open */
 static int
 file_error_or_write_close (CONVERTER *self, const char *out_filepath,
                            const char *encoded_out_filepath,
@@ -20648,6 +20650,7 @@ file_error_or_write_close (CONVERTER *self, const char 
*out_filepath,
                 self->conf, 0,
                 "could not open %s for writing: %s",
                  out_filepath, open_error_message);
+      return -2;
     }
   else
     {
@@ -21373,9 +21376,11 @@ html_node_redirections (CONVERTER *self,
                   free (out_filepath);
                   free (redirection_page);
                   free (open_error_message);
-                  if (status < 0)
+
+             /* NOTE failure to open a file does not stop the processing */
+                  if (status == -1)
                     return -1;
-                  else
+                  else if (status >= 0)
                     redirection_files_done++;
                 }
             }



reply via email to

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