[Top][All Lists]

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

Re: [Bug-gnulib] invalid use of errno after ferror

From: Bruno Haible
Subject: Re: [Bug-gnulib] invalid use of errno after ferror
Date: Thu, 18 Sep 2003 11:48:55 +0200
User-agent: KMail/1.5

Paul Eggert wrote:
> There's lots of other code that assumes that getc sets errno.
> What non-POSIX systems were you thinking of?

Windows (both the mingw and msvc build environments).

> Perhaps it would be better to let sleeping dogs lie, as the bug is not
> that serious in this case, and it occurs only on older or nonstandard
> systems.

The bug is "only" a possibly wrong error message...

> I'm reluctant to use fwriteerror.  If a GNU utility finds an error, it
> should report the first error that it found, not some other error that
> it finds in a fixup action.  Instead of using fwriteerror to paper
> over the problem, I'd rather fix the code so that it doesn't lose
> errno in the first place.

That was my first intention too. Then I updated gettext's write-mo.c and
write-tcl.c, changing dozens of

          fwrite (sysdep_tab, n_sysdep_strings * sizeof (nls_uint32), 1,


          if (fwrite (sysdep_tab, n_sysdep_strings * sizeof (nls_uint32), 1,
                      output_file) == 0)
            return -1;


        fprintf (output_file, "set ::msgcat::header ");


        if (fprintf (output_file, "set ::msgcat::header ") < 0)
          return -1;

and realized that the code had become unreadable and therefore unmaintainable.


reply via email to

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