bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH x 5] warnings, some legit


From: Jim Meyering
Subject: Re: [PATCH x 5] warnings, some legit
Date: Thu, 16 Oct 2008 23:02:11 +0200

Jim Meyering <address@hidden> wrote:
> Here's a 5-patch series from a week or so ago.
> It started out with the aim to avoid some warnings.
> Some of those warnings were legitimate.
>
> At first I was tempted to simply ignore any freopen failure,
> thinking that it was so unlikely as to be truly ignorable.
> And in addition, most are guarded by "if (O_BINARY &&...",
> so wouldn't even be compiled on systems I care about.
> However, there are actually many ways in which freopen can
> fail, so I wrote xfreopen and used that everywhere.
>
> Feedback welcome.
> I'll wait a day or two, just in case...
...
>>From 6fc767036a513dad05c43cca2253e7f0a1c3cde0 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Sun, 12 Oct 2008 16:09:00 +0200
> Subject: [PATCH] mktemp: diagnose freopen failure
>
> * src/mktemp [--quiet]: Don't ignore freopen failure.
> ---
>  src/mktemp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/src/mktemp.c b/src/mktemp.c
> index 295d134..8998f5c 100644
> --- a/src/mktemp.c
> +++ b/src/mktemp.c
> @@ -190,7 +190,9 @@ main (int argc, char **argv)
>      {
>        /* From here on, redirect stderr to /dev/null.
>           A diagnostic from getopt_long, above, would still go to stderr.  */
> -      freopen ("/dev/null", "wb", stderr);
> +      if (!freopen ("/dev/null", "wb", stderr))
> +        error (EXIT_FAILURE, errno,
> +               _("failed to redirect stderr to /dev/null"));
>      }
>
>    n_args = argc - optind;
> --
> 1.6.0.2.98.gc82e

I've pushed this one.




reply via email to

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