#include "cache.h"
+#include "config.h"
#include "lockfile.h"
#include "string-list.h"
#include "rerere.h"
free(rerere_dir[i]->status);
free(rerere_dir[i]);
}
- free(rerere_dir);
+ FREE_AND_NULL(rerere_dir);
rerere_dir_nr = rerere_dir_alloc = 0;
- rerere_dir = NULL;
}
static void free_rerere_id(struct string_list_item *item)
static void read_rr(struct string_list *rr)
{
struct strbuf buf = STRBUF_INIT;
- FILE *in = fopen(git_path_merge_rr(), "r");
+ FILE *in = fopen_or_warn(git_path_merge_rr(), "r");
if (!in)
return;
rerere_id_hex(id),
rr->items[i].string, 0);
- if (write_in_full(out_fd, buf.buf, buf.len) != buf.len)
+ if (write_in_full(out_fd, buf.buf, buf.len) < 0)
die("unable to write rerere record");
strbuf_release(&buf);
io.input = fopen(path, "r");
io.io.wrerror = 0;
if (!io.input)
- return error("Could not open %s", path);
+ return error_errno("Could not open %s", path);
if (output) {
io.io.output = fopen(output, "w");
if (!io.io.output) {
+ error_errno("Could not write %s", output);
fclose(io.input);
- return error("Could not write %s", output);
+ return -1;
}
}