Merge branch 'tr/die_errno'
* tr/die_errno: Use die_errno() instead of die() when checking syscalls Convert existing die(..., strerror(errno)) to die_errno() die_errno(): double % in strerror() output just in case Introduce die_errno() that appends strerror(errno) to die()
This commit is contained in:
10
diff.c
10
diff.c
@ -1975,14 +1975,14 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
|
||||
fd = git_mkstemps(temp->tmp_path, PATH_MAX, template.buf,
|
||||
strlen(base) + 1);
|
||||
if (fd < 0)
|
||||
die("unable to create temp-file: %s", strerror(errno));
|
||||
die_errno("unable to create temp-file");
|
||||
if (convert_to_working_tree(path,
|
||||
(const char *)blob, (size_t)size, &buf)) {
|
||||
blob = buf.buf;
|
||||
size = buf.len;
|
||||
}
|
||||
if (write_in_full(fd, blob, size) != size)
|
||||
die("unable to write temp-file");
|
||||
die_errno("unable to write temp-file");
|
||||
close(fd);
|
||||
temp->name = temp->tmp_path;
|
||||
strcpy(temp->hex, sha1_to_hex(sha1));
|
||||
@ -2021,12 +2021,12 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
|
||||
if (lstat(name, &st) < 0) {
|
||||
if (errno == ENOENT)
|
||||
goto not_a_valid_file;
|
||||
die("stat(%s): %s", name, strerror(errno));
|
||||
die_errno("stat(%s)", name);
|
||||
}
|
||||
if (S_ISLNK(st.st_mode)) {
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
if (strbuf_readlink(&sb, name, st.st_size) < 0)
|
||||
die("readlink(%s)", name);
|
||||
die_errno("readlink(%s)", name);
|
||||
prep_temp_blob(name, temp, sb.buf, sb.len,
|
||||
(one->sha1_valid ?
|
||||
one->sha1 : null_sha1),
|
||||
@ -2219,7 +2219,7 @@ static void diff_fill_sha1_info(struct diff_filespec *one)
|
||||
return;
|
||||
}
|
||||
if (lstat(one->path, &st) < 0)
|
||||
die("stat %s", one->path);
|
||||
die_errno("stat '%s'", one->path);
|
||||
if (index_path(one->sha1, one->path, &st, 0))
|
||||
die("cannot hash %s", one->path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user