[Top][All Lists]

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

Frozen fole is read in text mode but created in binary mode.

From: Juan Manuel Guerrero
Subject: Frozen fole is read in text mode but created in binary mode.
Date: Sat, 28 Jan 2023 22:31:04 +0100

I do not know if this issue has already been reported, but for all
systems that distinguish between binary and text I/O, the file should
be read in the same mode than it has been created or it may rise reading
issues.  When a "frozen" file is created in produce_frozen_state() this
is done using binary mode and that is ok.  But when it later is reloaded,
the reading is done without specifying the mode and this defaults to
text mode breaking/aborting the reading process.  The patch below fixes
the issue but it is only intended as suggestion.  Fix the issue as you

Juan M. Guerrero

2023-01-28  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

        * src/freeze.c (reload_frozen_state): For systems that distinguish
        between text and binary I/O the reloading of frozen files must be
        done in O_BINARY mode if it has been created in O_BINARY mode.

diff --git a/src/freeze.c b/src/freeze.c
index 2bc1fe7e..c08b163b 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -268,6 +268,7 @@ reload_frozen_state (const char *name)
   file = m4_path_search (name, NULL);
   if (file == NULL)
     m4_failure (errno, _("cannot open %s"), name);
+  SET_BINARY (fileno (file));
   current_file = name;

   allocated[0] = 100;

reply via email to

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