bug-coreutils
[Top][All Lists]
Advanced

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

bug#8154: du: issue with `--files0-from=DIR'


From: Stefan Vargyas
Subject: bug#8154: du: issue with `--files0-from=DIR'
Date: Wed, 2 Mar 2011 10:32:33 -0800 (PST)

Jim,

Maybe you would consider appropriate to keep 'wc.c' in sync with 'du.c':
with respect to 'argv_iter' processing, both files had similar code
patterns. Padraig indirectly suggested this too above in the thread.

Stefan.

> Date: Wed, 02 Mar 2011 16:26:03 +0100
> From: Jim Meyering <address@hidden>
> Subject: Re: bug#8154: du: issue with `--files0-from=DIR'
> 
> [...]
> 
> I've taken the opportunity (of this new label) to move the test
> for EOF into the case alongside the other AI_ERR_* values:
> 
> diff --git a/src/du.c b/src/du.c
> index 671cac7..6270092 100644
> --- a/src/du.c
> +++ b/src/du.c
> @@ -889,6 +889,8 @@ main (int argc, char **argv)
>                 quote (files_from));
> 
>        ai = argv_iter_init_stream (stdin);
> +      if (ai == NULL && errno == EISDIR)
> +        error (EXIT_FAILURE, errno, _("invalid file: %s"), quote
> (files_from));
> 
>        /* It's not easy here to count the arguments, so assume the
>           worst.  */
> @@ -926,15 +928,17 @@ main (int argc, char **argv)
>        bool skip_file = false;
>        enum argv_iter_err ai_err;
>        char *file_name = argv_iter (ai, &ai_err);
> -      if (ai_err == AI_ERR_EOF)
> -        break;
>        if (!file_name)
>          {
>            switch (ai_err)
>              {
> +            case AI_ERR_EOF:
> +              goto argv_iter_done;
> +
>              case AI_ERR_READ:
>                error (0, errno, _("%s: read error"), quote (files_from));
> -              continue;
> +              ok = false;
> +              goto argv_iter_done;
> 
>              case AI_ERR_MEM:
>                xalloc_die ();
> @@ -985,6 +989,7 @@ main (int argc, char **argv)
>            ok &= du_files (temp_argv, bit_flags);
>          }
>      }
> + argv_iter_done:
> 
>    argv_iter_free (ai);
>    di_set_free (di_set);



      





reply via email to

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