X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=server-info.c;h=66b0d9d878a011393582b837301eb1fd5caf2e40;hb=cec08717cca468c66eb454c7201fd35f54b48a58;hp=0d1312ca56d52daa3fc692984d4d3abaf3425791;hpb=d794d9e70ebb8c767b04f25c03290ef305cd31ab;p=git.git diff --git a/server-info.c b/server-info.c index 0d1312ca5..66b0d9d87 100644 --- a/server-info.c +++ b/server-info.c @@ -25,7 +25,7 @@ static int add_info_ref(const char *path, const unsigned char *sha1, int flag, v static int update_info_refs(int force) { - char *path0 = xstrdup(git_path("info/refs")); + char *path0 = git_pathdup("info/refs"); int len = strlen(path0); char *path1 = xmalloc(len + 2); @@ -35,7 +35,7 @@ static int update_info_refs(int force) safe_create_leading_directories(path0); info_ref_fp = fopen(path1, "w"); if (!info_ref_fp) - return error("unable to update %s", path0); + return error("unable to update %s", path1); for_each_ref(add_info_ref, NULL); fclose(info_ref_fp); adjust_shared_perm(path1); @@ -101,7 +101,7 @@ static int read_pack_info_file(const char *infofile) while (fgets(line, sizeof(line), fp)) { int len = strlen(line); - if (line[len-1] == '\n') + if (len && line[len-1] == '\n') line[--len] = 0; if (!len)