CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      07/07/22 22:53:35

Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- m4/output.c 10 Jul 2007 20:48:09 -0000      1.46
+++ m4/output.c 22 Jul 2007 22:53:35 -0000      1.47
@@ -250,6 +250,11 @@
              _("cannot create temporary file for diversion"));
   else if (set_cloexec_flag (fileno (file), true) != 0)
     m4_warn (context, errno, _("cannot protect diversion across forks"));
+  /* POSIX states that it is undefined whether an append stream starts
+     at offset 0 or at the end.  We want the beginning.  */
+  else if (fseeko (file, 0, SEEK_SET) != 0)
+    m4_error (context, EXIT_FAILURE, errno,
+             _("cannot seek to beginning of diversion"));
   return file;
 }
 


Reply via email to