pass st.st_size as hint for strbuf_readlink()
[gitweb.git] / refs / files-backend.c
index a9a066dcfb60d83a10e27d1c0d1131faf2ae97a4..c110c2520cb90bc254e96f51cde80ed43cd72947 100644 (file)
@@ -363,7 +363,7 @@ static int files_read_raw_ref(struct ref_store *ref_store,
        /* Follow "normalized" - ie "refs/.." symlinks by hand */
        if (S_ISLNK(st.st_mode)) {
                strbuf_reset(&sb_contents);
-               if (strbuf_readlink(&sb_contents, path, 0) < 0) {
+               if (strbuf_readlink(&sb_contents, path, st.st_size) < 0) {
                        if (errno == ENOENT || errno == EINVAL)
                                /* inconsistent with lstat; retry */
                                goto stat_ref;