print errno when reporting a system call error
[gitweb.git] / read-cache.c
index d8c657d6a7faa717be8459cf88de83acc51ddde1..b3d0f3c30bfd7ee054d406afd8d8df29342105c2 100644 (file)
@@ -1824,9 +1824,10 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
  */
 static void freshen_shared_index(char *base_sha1_hex, int warn)
 {
-       const char *shared_index = git_path("sharedindex.%s", base_sha1_hex);
+       char *shared_index = git_pathdup("sharedindex.%s", base_sha1_hex);
        if (!check_and_freshen_file(shared_index, 1) && warn)
                warning("could not freshen shared index '%s'", shared_index);
+       free(shared_index);
 }
 
 int read_index_from(struct index_state *istate, const char *path)