Code

git-bundle: assorted fixes
[git.git] / index-pack.c
index 24bbdcd82fef7fd799f2678978ceb959cc2d4f62..64d75f8c4d592ce39d390ed6e89fa58b9374c68d 100644 (file)
@@ -457,8 +457,9 @@ 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 (input_fd && S_ISREG(st.st_mode) && st.st_size != consumed_bytes)
-               die("pack has junk at the end: 0%o, %d, %d %d", st.st_mode, (int)st.st_size, (int)consumed_bytes, input_fd);
+       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)
                return;