texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * install-info/install-info.c (open_possibly_comp


From: Gavin D. Smith
Subject: branch master updated: * install-info/install-info.c (open_possibly_compressed_file): Close stdin file description in main process after calling popen on compression program. This allows the file to be removed or renamed on Windows.
Date: Sun, 08 Oct 2023 11:54:56 -0400

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

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 8f29de6909 * install-info/install-info.c 
(open_possibly_compressed_file): Close stdin file description in main process 
after calling popen on compression program.  This allows the file to be removed 
or renamed on Windows.
8f29de6909 is described below

commit 8f29de69092a55fb602e55a22f18df24f7d50fad
Author: Eli Zaretskii <eliz@gnu.org>
AuthorDate: Sun Oct 8 16:54:39 2023 +0100

    * install-info/install-info.c (open_possibly_compressed_file):
    Close stdin file description in main process after calling popen
    on compression program.  This allows the file to be removed or
    renamed on Windows.
---
 ChangeLog                   | 7 +++++++
 install-info/install-info.c | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 69a0ee5613..0587f7ad3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-10-08  Eli Zaretskii <eliz@gnu.org>
+
+       * install-info/install-info.c (open_possibly_compressed_file):
+       Close stdin file description in main process after calling popen
+       on compression program.  This allows the file to be removed or
+       renamed on Windows.
+
 2023-10-08  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS/parsetexi/input.c (next_text):
diff --git a/install-info/install-info.c b/install-info/install-info.c
index 750fb43461..3873469342 100644
--- a/install-info/install-info.c
+++ b/install-info/install-info.c
@@ -826,13 +826,15 @@ determine_file_type:
       /* Redirect stdin to the file and fork the decompression process
          reading from stdin.  This allows shell metacharacters in filenames. */
       char *command = concat (*compression_program, " -d", "");
+      FILE *f2;
 
       if (fclose (f) < 0)
         return 0;
-      f = freopen (*opened_filename, FOPEN_RBIN, stdin);
+      f2 = freopen (*opened_filename, FOPEN_RBIN, stdin);
       if (!f)
         return 0;
       f = popen (command, "r");
+      fclose (f2);
       if (!f)
         {
           /* Used for error message in calling code. */



reply via email to

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