bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: patch for m4-1.4.1


From: Marion Hakanson
Subject: Re: patch for m4-1.4.1
Date: Thu, 05 Aug 2004 15:25:42 -0700

Andreas writes:
> "Marion Hakanson" <address@hidden> writes:
> 
> > @@ -469,8 +470,11 @@
> >  
> >    errno = 0;
> >    while (length = fread (buffer, 1, COPY_BUFFER_SIZE, file),
> > -        length != 0)
> > +        length != 0) {
> > +    saved_errno = errno;
> >      output_text (buffer, length);
> > +    errno = saved_errno;
> > +  }
> >    if (errno)
> >      M4ERROR ((EXIT_FAILURE, errno, "ERROR: Reading inserted file"));
> >  }
> 
> This is not correct either, fread is allowed to set errno even if
> successful.  The only reliable way to get an error indicator is to use
> ferror().
> 
> Andreas.

That's a very good point.  The patch above merely addresses the problem of
errno being changed by something other than the fread() call, a condition
that I was actually experiencing.  It was not intended to deal with the
possible fread() misuse issue.  That issue will probably need to be
addressed in many other locations in the code -- I regret not having
the resources to pursue a more complete fix at this time.

Regards,

Marion Hakanson







reply via email to

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