Code

git-bundle: assorted fixes
[git.git] / index-pack.c
index 8d10d6ba243ee99d698ddbb7651a10422cc5c9ba..64d75f8c4d592ce39d390ed6e89fa58b9374c68d 100644 (file)
@@ -457,7 +457,8 @@ static void parse_pack_objects(unsigned char *sha1)
        /* If input_fd is a file, we should have reached its end now. */
        if (fstat(input_fd, &st))
                die("cannot fstat packfile: %s", strerror(errno));
-       if (S_ISREG(st.st_mode) && st.st_size != consumed_bytes)
+       if (S_ISREG(st.st_mode) &&
+                       lseek(input_fd, 0, SEEK_CUR) - input_len != st.st_size)
                die("pack has junk at the end");
 
        if (!nr_deltas)
@@ -814,7 +815,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
                char buf[48];
                int len = snprintf(buf, sizeof(buf), "%s\t%s\n",
                                   report, sha1_to_hex(sha1));
-               write_in_full(1, buf, len);
+               write_or_die(1, buf, len);
 
                /*
                 * Let's just mimic git-unpack-objects here and write