Code

Merge branch 'tr/add-i-no-escape' into maint
[git.git] / rerere.c
index 3d00a71ff9730ed4a10114185f4360de698c1fbf..6ec452f7bc689c02ff663ab2cd1f6f1a068fe08c 100644 (file)
--- 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;