From: Johannes Schindelin Date: Mon, 02 May 2016 07:09:21 GMT Subject: Re: [PATCH 63/83] builtin/apply: make apply_all_patches() return -1 on error Message-ID: In-Reply-To: Hi Eric, On Sun, 1 May 2016, Eric Sunshine wrote: > On Sun, Apr 24, 2016 at 9:34 AM, Christian Couder > wrote: > > Signed-off-by: Christian Couder > > --- > > diff --git a/builtin/apply.c b/builtin/apply.c > > @@ -4562,12 +4562,12 @@ static int apply_all_patches(struct apply_state *state, > > > > fd = open(arg, O_RDONLY); > > if (fd < 0) > > - die_errno(_("can't open patch '%s'"), arg); > > + return error(_("can't open patch '%s': %s"), arg, strerror(errno)); > > read_stdin = 0; > > set_default_whitespace_mode(state); > > res = apply_patch(state, fd, arg, options); > > if (res < 0) > > - exit(1); > > + return -1; > > This leaks 'fd', doesn't it? Indeed it does. I thought that I had sent a mail about fd leakage, just resent it. Such a leakage prevented the test suite from passing after applying this patch series on Windows and patching up several obvious compile problems. Ciao, Dscho