X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=update-cache.c;h=19d8f826a5d266c3ca0271c5b29c7fc504632d30;hb=2ecd90502f4615c4f1a9340dfaed3f78ecd23747;hp=2f5d620fd8b849d761a2bf337ecdd86f251271ac;hpb=f1a7eb36b017c62d9a007b6b8660bdeec3f94f97;p=git.git diff --git a/update-cache.c b/update-cache.c index 2f5d620f..19d8f826 100644 --- a/update-cache.c +++ b/update-cache.c @@ -73,7 +73,7 @@ static int add_file_to_cache(char *path) if (allow_remove) return remove_file_from_cache(path); } - return -1; + return error("open(\"%s\"): %s", path, strerror(errno)); } namelen = strlen(path); size = cache_entry_size(namelen); @@ -131,7 +131,7 @@ static int compare_data(struct cache_entry *ce, unsigned long expected_size) if (fd >= 0) { void *buffer; unsigned long size; - char type[10]; + char type[20]; buffer = read_sha1_file(ce->sha1, type, &size); if (buffer) { @@ -249,6 +249,9 @@ static int refresh_cache(void) continue; } active_cache_changed = 1; + /* You can NOT just free active_cache[i] here, since it + * might not be necessarily malloc()ed but can also come + * from mmap(). */ active_cache[i] = new; } return has_errors;