diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-05-08 11:47:29 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-09 21:29:08 +0200 |
commit | 62f94d54a98983a19cc9dc82daec5c76df466b0b (patch) | |
tree | 14430bbd0390192534baed5d19aae7753e83314c /builtin/merge-file.c | |
parent | builtin/mailsplit.c: use error_errno() (diff) | |
download | git-62f94d54a98983a19cc9dc82daec5c76df466b0b.tar.xz git-62f94d54a98983a19cc9dc82daec5c76df466b0b.zip |
builtin/merge-file.c: use error_errno()
All these error() calls do not print error message previously, but
because when they are called, errno should be set. Use error_errno()
instead to give more information.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-file.c')
-rw-r--r-- | builtin/merge-file.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 55447053f2..13e22a2f0b 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -62,8 +62,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) usage_with_options(merge_file_usage, options); if (quiet) { if (!freopen("/dev/null", "w", stderr)) - return error("failed to redirect stderr to /dev/null: " - "%s", strerror(errno)); + return error_errno("failed to redirect stderr to /dev/null"); } if (prefix) @@ -95,12 +94,13 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) FILE *f = to_stdout ? stdout : fopen(fpath, "wb"); if (!f) - ret = error("Could not open %s for writing", filename); + ret = error_errno("Could not open %s for writing", + filename); else if (result.size && fwrite(result.ptr, result.size, 1, f) != 1) - ret = error("Could not write to %s", filename); + ret = error_errno("Could not write to %s", filename); else if (fclose(f)) - ret = error("Could not close %s", filename); + ret = error_errno("Could not close %s", filename); free(result.ptr); } |