Code

git config: reorganize to use parseopt
[git.git] / server-info.c
index a051e49a9ea2f605bdc278394de731ff4c55e627..66b0d9d878a011393582b837301eb1fd5caf2e40 100644 (file)
@@ -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);
 
@@ -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)