Print the real filename that we failed to open.

When we fail to open a temporary file to be renamed to something else,
we reported the final filename, not the temporary file we failed to
open.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
André Goddard Rosa 2007-11-21 18:59:14 -02:00 committed by Junio C Hamano
parent 757f58ed38
commit 84ef033832
3 changed files with 5 additions and 5 deletions

View File

@ -433,7 +433,7 @@ static void start_fetch_packed(struct transfer_request *request)
packfile = fopen(request->tmpfile, "a"); packfile = fopen(request->tmpfile, "a");
if (!packfile) { if (!packfile) {
fprintf(stderr, "Unable to open local file %s for pack", fprintf(stderr, "Unable to open local file %s for pack",
filename); request->tmpfile);
remote->can_update_info_refs = 0; remote->can_update_info_refs = 0;
free(url); free(url);
return; return;
@ -941,7 +941,7 @@ static int fetch_index(unsigned char *sha1)
indexfile = fopen(tmpfile, "a"); indexfile = fopen(tmpfile, "a");
if (!indexfile) if (!indexfile)
return error("Unable to open local file %s for pack index", return error("Unable to open local file %s for pack index",
filename); tmpfile);
slot = get_active_slot(); slot = get_active_slot();
slot->results = &results; slot->results = &results;

View File

@ -405,7 +405,7 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch
indexfile = fopen(tmpfile, "a"); indexfile = fopen(tmpfile, "a");
if (!indexfile) if (!indexfile)
return error("Unable to open local file %s for pack index", return error("Unable to open local file %s for pack index",
filename); tmpfile);
slot = get_active_slot(); slot = get_active_slot();
slot->results = &results; slot->results = &results;
@ -770,7 +770,7 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha
packfile = fopen(tmpfile, "a"); packfile = fopen(tmpfile, "a");
if (!packfile) if (!packfile)
return error("Unable to open local file %s for pack", return error("Unable to open local file %s for pack",
filename); tmpfile);
slot = get_active_slot(); slot = get_active_slot();
slot->results = &results; slot->results = &results;

View File

@ -35,7 +35,7 @@ static int update_info_refs(int force)
safe_create_leading_directories(path0); safe_create_leading_directories(path0);
info_ref_fp = fopen(path1, "w"); info_ref_fp = fopen(path1, "w");
if (!info_ref_fp) 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); for_each_ref(add_info_ref, NULL);
fclose(info_ref_fp); fclose(info_ref_fp);
adjust_shared_perm(path1); adjust_shared_perm(path1);