bug-gnulib
[Top][All Lists]
Advanced

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

Re: proposed change to closeout module


From: Paul Eggert
Subject: Re: proposed change to closeout module
Date: Fri, 29 Sep 2006 10:38:40 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

> +   /* Close standard error.  This is simpler than fwriteerror_no_ebadf, 
> because
> +      upon failure we don't need an errno - all we can do at this point is to
> +      set an exit status.  */
> +   errno = 0; 
> +   if (ferror (stderr) || fflush (stderr))
> +     {
> +       fclose (stderr);
> +       _exit (exit_failure);
> +     }
> +   if (fclose (stderr) && errno != EBADF)
> +     _exit (exit_failure);
>   }

I like the basic idea.  As I understand it this affects only programs
that issue "warnings" (i.e., they output to stderr but then continue
without affecting the exit status) but it's useful for that case.

However, wouldn't this implementation be simpler?

   if (close_stream (stderr) != 0)
     _exit (exit_failure);

At any rate let's wait until coreutils 6.3 gets out.




reply via email to

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