diff --git a/server-info.c b/server-info.c
index 0d1312ca56d52daa3fc692984d4d3abaf3425791..c1c073b2f05a48772a45602cdc711eef6e211695 100644 (file)
--- a/server-info.c
+++ b/server-info.c
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);
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)