Re: [PATCH] mailsplit.c: remove dead code

2014-08-17 Thread Jeff King
On Tue, Aug 12, 2014 at 06:38:38PM +0200, René Scharfe wrote: > Am 11.08.2014 um 23:11 schrieb Stefan Beller: > >This was found by coverity. (Id: 290001) > > > >the variable 'output' is only assigned to a value inequal to NUL, > >after all gotos to the corrupt label. > >Therefore we can conclude t

Re: [PATCH] mailsplit.c: remove dead code

2014-08-12 Thread Jonathan Nieder
Stefan Beller wrote: > This was found by coverity. (Id: 290001) [...] > Signed-off-by: Stefan Beller > Helped-by: René Scharfe > --- > builtin/mailsplit.c | 17 ++--- > 1 file changed, 6 insertions(+), 11 deletions(-) The idea is to simplify error handling (removing cleanup of the

Re: [PATCH] mailsplit.c: remove dead code

2014-08-12 Thread Matthieu Moy
Junio C Hamano writes: > Matthieu Moy writes: > >> Stefan Beller writes: >> >>> + if (is_bare && !allow_bare) { >>> + unlink(name); >>> + fprintf(stderr, "corrupt mailbox\n"); >>> + exit(1); >>> + } >> >> Not directly related to your patch, but shouldn't this b

Re: [PATCH] mailsplit.c: remove dead code

2014-08-12 Thread Junio C Hamano
... answering to myself, the only invoker does not seem to care, so I do not mind if the fprintf/exit gets turned into die() in a follow-up patch. Thanks. On Tue, Aug 12, 2014 at 2:38 PM, Junio C Hamano wrote: > Matthieu Moy writes: > >> Stefan Beller writes: >> >>> +if (is_bare && !allow_

Re: [PATCH] mailsplit.c: remove dead code

2014-08-12 Thread Junio C Hamano
Matthieu Moy writes: > Stefan Beller writes: > >> +if (is_bare && !allow_bare) { >> +unlink(name); >> +fprintf(stderr, "corrupt mailbox\n"); >> +exit(1); >> +} > > Not directly related to your patch, but shouldn't this be using > > die(_("corrupt mailb

Re: [PATCH] mailsplit.c: remove dead code

2014-08-12 Thread Matthieu Moy
Stefan Beller writes: > + if (is_bare && !allow_bare) { > + unlink(name); > + fprintf(stderr, "corrupt mailbox\n"); > + exit(1); > + } Not directly related to your patch, but shouldn't this be using die(_("corrupt mailbox")); instead? -- Matthieu M

[PATCH] mailsplit.c: remove dead code

2014-08-12 Thread Stefan Beller
This was found by coverity. (Id: 290001) The variable 'output' is assigned to a value after all gotos to the corrupt label. Remove the goto by moving the errorhandling code to the condition, which detects the error. Signed-off-by: Stefan Beller Helped-by: René Scharfe --- builtin/mailsplit.c

Re: [PATCH] mailsplit.c: remove dead code

2014-08-12 Thread René Scharfe
Am 11.08.2014 um 23:11 schrieb Stefan Beller: This was found by coverity. (Id: 290001) the variable 'output' is only assigned to a value inequal to NUL, after all gotos to the corrupt label. Therefore we can conclude the two removed lines are actually dead code. After reading the above for the

[PATCH] mailsplit.c: remove dead code

2014-08-11 Thread Stefan Beller
This was found by coverity. (Id: 290001) the variable 'output' is only assigned to a value inequal to NUL, after all gotos to the corrupt label. Therefore we can conclude the two removed lines are actually dead code. Signed-off-by: Stefan Beller --- builtin/mailsplit.c | 2 -- 1 file changed, 2