texinfo-commits
[Top][All Lists]
Advanced

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

[6165] close existing stream before openingfile again on stdin


From: Gavin D. Smith
Subject: [6165] close existing stream before openingfile again on stdin
Date: Fri, 27 Feb 2015 18:46:11 +0000

Revision: 6165
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6165
Author:   gavin
Date:     2015-02-27 18:46:10 +0000 (Fri, 27 Feb 2015)
Log Message:
-----------
close existing stream before openingfile again on stdin

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/install-info/Makefile.am
    trunk/install-info/install-info.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-02-27 18:34:14 UTC (rev 6164)
+++ trunk/ChangeLog     2015-02-27 18:46:10 UTC (rev 6165)
@@ -1,3 +1,12 @@
+2015-02-27  Gavin Smith  <address@hidden>
+
+       * install-info/install-info.c (open_possibly_compressed_file): 
+       If file is compressed, close it before opening it again on 
+       stdin.
+       (format_entry): Remove unused local variable.
+       * install-info/Makefile.am (SUBDIRS): Put "." before tests to 
+       make sure that "make check" works without doing "make" first.
+
 2015-02-27  Ken Brown  <address@hidden>
 
        * install-info/install-info.c (open_possibly_compressed_file):

Modified: trunk/install-info/Makefile.am
===================================================================
--- trunk/install-info/Makefile.am      2015-02-27 18:34:14 UTC (rev 6164)
+++ trunk/install-info/Makefile.am      2015-02-27 18:46:10 UTC (rev 6165)
@@ -11,7 +11,7 @@
 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
-SUBDIRS = tests
+SUBDIRS = . tests
 bin_PROGRAMS = ginstall-info
 
 w32_script = ginstall-info.exe.manifest

Modified: trunk/install-info/install-info.c
===================================================================
--- trunk/install-info/install-info.c   2015-02-27 18:34:14 UTC (rev 6164)
+++ trunk/install-info/install-info.c   2015-02-27 18:46:10 UTC (rev 6165)
@@ -843,12 +843,15 @@
 
   if (*compression_program)
     { /* It's compressed, so open a pipe.  */
+      char *command = concat (*compression_program, " -d", "");
+
+      if (fclose (f) < 0)
+        return 0;
       f = freopen (*opened_filename, FOPEN_RBIN, stdin);
       if (!f)
         return 0;
-      char *command = concat (*compression_program, " -d", "");
       f = popen (command, "r");
-      if (! f)
+      if (!f)
         {
           /* Used for error message in calling code. */
           *opened_filename = command;
@@ -1393,7 +1396,6 @@
   size_t offset_out = 0;        /* Index in `line_out' for next char. */
   static char *line_out = NULL;
   static size_t allocated_out = 0;
-  int saved_errno;
   if (!desc || !name)
     return 1;
 
@@ -1512,8 +1514,6 @@
       line_out[offset_out++] = c;
     }
 
-  saved_errno = errno;
-
   if (desc_len <= 2)
     strncat (*outstr, "\n", 1);
 




reply via email to

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