Convert existing die(..., strerror(errno)) to die_errno()
Change calls to die(..., strerror(errno)) to use the new die_errno(). In the process, also make slight style adjustments: at least state _something_ about the function that failed (instead of just printing the pathname), and put paths in single quotes. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f8b5a8e13c
commit
d824cbba02
10
pack-write.c
10
pack-write.c
@ -51,7 +51,7 @@ char *write_idx_file(char *index_name, struct pack_idx_entry **objects,
|
||||
fd = open(index_name, O_CREAT|O_EXCL|O_WRONLY, 0600);
|
||||
}
|
||||
if (fd < 0)
|
||||
die("unable to create %s: %s", index_name, strerror(errno));
|
||||
die_errno("unable to create '%s'", index_name);
|
||||
f = sha1fd(fd, index_name);
|
||||
|
||||
/* if last object's offset is >= 2^31 we should use index V2 */
|
||||
@ -174,11 +174,11 @@ void fixup_pack_header_footer(int pack_fd,
|
||||
git_SHA1_Init(&new_sha1_ctx);
|
||||
|
||||
if (lseek(pack_fd, 0, SEEK_SET) != 0)
|
||||
die("Failed seeking to start of %s: %s", pack_name, strerror(errno));
|
||||
die_errno("Failed seeking to start of '%s'", pack_name);
|
||||
if (read_in_full(pack_fd, &hdr, sizeof(hdr)) != sizeof(hdr))
|
||||
die("Unable to reread header of %s: %s", pack_name, strerror(errno));
|
||||
die_errno("Unable to reread header of '%s'", pack_name);
|
||||
if (lseek(pack_fd, 0, SEEK_SET) != 0)
|
||||
die("Failed seeking to start of %s: %s", pack_name, strerror(errno));
|
||||
die_errno("Failed seeking to start of '%s'", pack_name);
|
||||
git_SHA1_Update(&old_sha1_ctx, &hdr, sizeof(hdr));
|
||||
hdr.hdr_entries = htonl(object_count);
|
||||
git_SHA1_Update(&new_sha1_ctx, &hdr, sizeof(hdr));
|
||||
@ -195,7 +195,7 @@ void fixup_pack_header_footer(int pack_fd,
|
||||
if (!n)
|
||||
break;
|
||||
if (n < 0)
|
||||
die("Failed to checksum %s: %s", pack_name, strerror(errno));
|
||||
die_errno("Failed to checksum '%s'", pack_name);
|
||||
git_SHA1_Update(&new_sha1_ctx, buf, n);
|
||||
|
||||
aligned_sz -= n;
|
||||
|
Reference in New Issue
Block a user