Re: [dev] [sbase] [PATCH v2] rm: Fix exit status with -f for nonexistent paths

From: Michael Forney <mforney_AT_mforney.org>
Date: Sun, 1 Mar 2015 23:02:00 -0800

On Sun, Mar 01, 2015 at 11:51:35PM +0100, FRIGN wrote:
> On Sun, 1 Mar 2015 14:44:12 -0800
> Michael Forney <mforney_AT_mforney.org> wrote:
> > That looks good to me.
>
> Thanks! Applied:
> http://git.2f30.org/sbase/commit/?id=48696d8c955db9d0621812aca7ef5caac727da31

I just realized that this could potentially mask an error from a
previous rm(). For example, if you run

  rm -f foo bar

where foo exists and can't be removed, but bar does not exist, this will
exit with status 0.

So I think we need to do

  if (!(rm_fflag && errno == ENOENT))
          rm_status = 1;

instead of

  rm_status = !(rm_fflag && errno == ENOENT);


Received on Mon Mar 02 2015 - 08:02:00 CET

This archive was generated by hypermail 2.3.0 : Mon Mar 02 2015 - 08:12:07 CET