[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: fix fread portability bug [m4--devo--1.0--patch-4]
From: |
Gary V. Vaughan |
Subject: |
FYI: fix fread portability bug [m4--devo--1.0--patch-4] |
Date: |
Wed, 4 May 2005 19:41:43 +0100 (BST) |
User-agent: |
mailnotify/0.6 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Applied to HEAD.
* looking for address@hidden/m4--devo--1.0--patch-3 to compare with
* comparing to address@hidden/m4--devo--1.0--patch-3
M ChangeLog
M m4/output.c
* modified files
Index: Changelog
from Paul Eggert <address@hidden>
* m4/output.c (m4_insert_file): Don't assume errno has a valid
value simply because fread returns zero. This fixes a
portability bug reported by Marion Hakanson in
<http://lists.gnu.org/archive/html/bug-m4/2004-07/msg00029.html>.
--- orig/m4/output.c
+++ mod/m4/output.c
@@ -1,5 +1,5 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1998, 2002
+ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1998, 2002, 2004
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -575,13 +575,15 @@
return;
/* Insert output by big chunks. */
- errno = 0;
- while (length = fread (buffer, 1, COPY_BUFFER_SIZE, file),
- length != 0)
- output_text (buffer, length);
-
- if (errno)
- M4ERROR ((EXIT_FAILURE, errno, _("reading inserted file")));
+ for (;;)
+ {
+ length = fread (buffer, 1, COPY_BUFFER_SIZE, file);
+ if (ferror (file))
+ M4ERROR ((EXIT_FAILURE, errno, _("reading inserted file")));
+ if (length == 0)
+ break;
+ output_text (buffer, length);
+ }
}
/* Insert diversion number DIVNUM into the current output file. The
- --
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
_________________________________________________________
This patch notification generated by tlaapply version 0.9
http://tkd.kicks-ass.net/arch/address@hidden/cvs-utils--tla--1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCeRdmFRMICSmD1gYRAuavAKCw/imgQpZ0jrafkzCCVlkdsIw4tQCbBo9e
JXn3h6pc/wqA0MeBXpvOMKE=
=A2PE
-----END PGP SIGNATURE-----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: fix fread portability bug [m4--devo--1.0--patch-4],
Gary V. Vaughan <=