X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=rerere.c;h=6ec452f7bc689c02ff663ab2cd1f6f1a068fe08c;hb=7769a75e96f998b2f1ef51e8a2e88058f56fa519;hp=22996bd08b532fb8016f24391dd0e63010706385;hpb=b3369abfeb4b1630905de2ab516aeb946c0c19db;p=git.git diff --git a/rerere.c b/rerere.c index 22996bd08..6ec452f7b 100644 --- a/rerere.c +++ b/rerere.c @@ -47,8 +47,14 @@ static void read_rr(struct string_list *rr) name = xstrdup(buf); if (fgetc(in) != '\t') die("corrupt MERGE_RR"); - for (i = 0; i < sizeof(buf) && (buf[i] = fgetc(in)); i++) - ; /* do nothing */ + for (i = 0; i < sizeof(buf); i++) { + int c = fgetc(in); + if (c < 0) + die("corrupt MERGE_RR"); + buf[i] = c; + if (c == 0) + break; + } if (i == sizeof(buf)) die("filename too long"); string_list_insert(rr, buf)->util = name; @@ -438,7 +444,7 @@ static int merge(const char *name, const char *path) ret = 1; goto out; } - ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", 0); + ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", NULL); if (!ret) { FILE *f; @@ -590,8 +596,7 @@ static int is_rerere_enabled(void) if (rerere_enabled < 0) return rr_cache_exists; - if (!rr_cache_exists && - (mkdir(rr_cache, 0777) || adjust_shared_perm(rr_cache))) + if (!rr_cache_exists && mkdir_in_gitdir(rr_cache)) die("Could not create directory %s", rr_cache); return 1; }