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

2015-03-01 Thread Michael Forney
On Sun, Mar 01, 2015 at 11:51:35PM +0100, FRIGN wrote: > On Sun, 1 Mar 2015 14:44:12 -0800 > Michael Forney 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 e

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

2015-03-01 Thread FRIGN
On Sun, 1 Mar 2015 14:44:12 -0800 Michael Forney wrote: > That looks good to me. Thanks! Applied: http://git.2f30.org/sbase/commit/?id=48696d8c955db9d0621812aca7ef5caac727da31 -- FRIGN

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

2015-03-01 Thread Michael Forney
On Sun, Mar 01, 2015 at 11:23:28PM +0100, FRIGN wrote: > I'd do it like this instead, makes it clearer that we're > dealing with one special case: > > if (remove(path) < 0) { > if (!rm_fflag) > weprintf("remove %s:", path); > rm_status = !(rm

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

2015-03-01 Thread FRIGN
On Sun, 1 Mar 2015 21:59:02 + Michael Forney wrote: Hey Michael, Thanks for paying so close attention! You are right about the return value! > if (remove(path) < 0) { > + if (!rm_fflag || errno != ENOENT) > + rm_status = 1; > if (!rm_ffla

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

2015-03-01 Thread Michael Forney
Under the description for the -f option, POSIX says, "Do not modify the exit status in the case of nonexistent operands". --- Whoops, just realized that simply using the errno from the remove call is way simpler. libutil/rm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a

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

2015-03-01 Thread Michael Forney
Under the description for the -f option, POSIX says, "Do not modify the exit status in the case of nonexistent operands". --- libutil/rm.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libutil/rm.c b/libutil/rm.c index 53ae3f2..30a1b41 100644 --- a/libutil/rm.c +++ b/li