rerere.c: use error_errno() and warning_errno()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
9a3acba1ca
commit
033e011e64
18
rerere.c
18
rerere.c
@ -351,8 +351,7 @@ static int handle_file(const char *path, unsigned char *sha1, const char *output
|
|||||||
error("There were errors while writing %s (%s)",
|
error("There were errors while writing %s (%s)",
|
||||||
path, strerror(io.io.wrerror));
|
path, strerror(io.io.wrerror));
|
||||||
if (io.io.output && fclose(io.io.output))
|
if (io.io.output && fclose(io.io.output))
|
||||||
io.io.wrerror = error("Failed to flush %s: %s",
|
io.io.wrerror = error_errno("Failed to flush %s", path);
|
||||||
path, strerror(errno));
|
|
||||||
|
|
||||||
if (hunk_no < 0) {
|
if (hunk_no < 0) {
|
||||||
if (output)
|
if (output)
|
||||||
@ -614,20 +613,17 @@ static int merge(const struct rerere_id *id, const char *path)
|
|||||||
* Mark that "postimage" was used to help gc.
|
* Mark that "postimage" was used to help gc.
|
||||||
*/
|
*/
|
||||||
if (utime(rerere_path(id, "postimage"), NULL) < 0)
|
if (utime(rerere_path(id, "postimage"), NULL) < 0)
|
||||||
warning("failed utime() on %s: %s",
|
warning_errno("failed utime() on %s",
|
||||||
rerere_path(id, "postimage"),
|
rerere_path(id, "postimage"));
|
||||||
strerror(errno));
|
|
||||||
|
|
||||||
/* Update "path" with the resolution */
|
/* Update "path" with the resolution */
|
||||||
f = fopen(path, "w");
|
f = fopen(path, "w");
|
||||||
if (!f)
|
if (!f)
|
||||||
return error("Could not open %s: %s", path,
|
return error_errno("Could not open %s", path);
|
||||||
strerror(errno));
|
|
||||||
if (fwrite(result.ptr, result.size, 1, f) != 1)
|
if (fwrite(result.ptr, result.size, 1, f) != 1)
|
||||||
error("Could not write %s: %s", path, strerror(errno));
|
error_errno("Could not write %s", path);
|
||||||
if (fclose(f))
|
if (fclose(f))
|
||||||
return error("Writing %s failed: %s", path,
|
return error_errno("Writing %s failed", path);
|
||||||
strerror(errno));
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(cur.ptr);
|
free(cur.ptr);
|
||||||
@ -842,7 +838,7 @@ static int rerere_forget_one_path(const char *path, struct string_list *rr)
|
|||||||
if (unlink(filename))
|
if (unlink(filename))
|
||||||
return (errno == ENOENT
|
return (errno == ENOENT
|
||||||
? error("no remembered resolution for %s", path)
|
? error("no remembered resolution for %s", path)
|
||||||
: error("cannot unlink %s: %s", filename, strerror(errno)));
|
: error_errno("cannot unlink %s", filename));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the preimage so that the user can resolve the
|
* Update the preimage so that the user can resolve the
|
||||||
|
Loading…
Reference in New Issue
Block a user