Code

Print the real filename that we failed to open.
authorAndré Goddard Rosa <andre.goddard@gmail.com>
Wed, 21 Nov 2007 20:59:14 +0000 (18:59 -0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Nov 2007 00:53:32 +0000 (16:53 -0800)
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>
http-push.c
http-walker.c
server-info.c

index 66b81f17266569ee47d32ec58df9d1386e4d0431..78283b4de3b9111d87368df747daa96b5f6c09c3 100644 (file)
@@ -433,7 +433,7 @@ static void start_fetch_packed(struct transfer_request *request)
        packfile = fopen(request->tmpfile, "a");
        if (!packfile) {
                fprintf(stderr, "Unable to open local file %s for pack",
-                       filename);
+                       request->tmpfile);
                remote->can_update_info_refs = 0;
                free(url);
                return;
@@ -941,7 +941,7 @@ static int fetch_index(unsigned char *sha1)
        indexfile = fopen(tmpfile, "a");
        if (!indexfile)
                return error("Unable to open local file %s for pack index",
-                            filename);
+                            tmpfile);
 
        slot = get_active_slot();
        slot->results = &results;
index 444aebf5268c982255f73b151ff5c03bdffecdbe..a3fb596542eea6d85a6cb32add100e8d71e7713a 100644 (file)
@@ -405,7 +405,7 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch
        indexfile = fopen(tmpfile, "a");
        if (!indexfile)
                return error("Unable to open local file %s for pack index",
-                            filename);
+                            tmpfile);
 
        slot = get_active_slot();
        slot->results = &results;
@@ -770,7 +770,7 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha
        packfile = fopen(tmpfile, "a");
        if (!packfile)
                return error("Unable to open local file %s for pack",
-                            filename);
+                            tmpfile);
 
        slot = get_active_slot();
        slot->results = &results;
index 0d1312ca56d52daa3fc692984d4d3abaf3425791..a051e49a9ea2f605bdc278394de731ff4c55e627 100644 (file)
@@ -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);