André Goddard Rosa, Thu, Nov 22, 2007 01:59:00 +0100:
quoted hunk ↗ jump to hunk
@@ -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