From: Alex Riesen Date: Thu, 22 Nov 2007 16:09:59 GMT Subject: Re: [PATCH] Fix segmentation fault when user doesn't have access permission to the repository. Message-ID: <20071122160959.GA3411@steel.home> In-Reply-To: André Goddard Rosa, Thu, Nov 22, 2007 01:59:00 +0100: > @@ -487,8 +490,13 @@ static int do_fetch(struct transport *transport, > die("Don't know how to fetch from %s", transport->url); > > /* if not appending, truncate FETCH_HEAD */ > - if (!append) > - fclose(fopen(git_path("FETCH_HEAD"), "w")); > + if (!append) { > + char *filename = git_path("FETCH_HEAD"); > + int fd = fopen(filename, "w"); This should have been "FILE *fp", not "int fd". > + if (!fd) > + return error("cannot open %s: %s\n", filename, strerror(errno)); > + fclose(fd); > + } > > ref_map = get_ref_map(transport, refs, ref_count, tags, &autotags); > > -- > 1.5.3.6.861.gd794-dirty >