summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-05-08 16:47:28 +0700
committerJunio C Hamano <gitster@pobox.com>2016-05-09 12:29:08 -0700
commit880c0aef0fa8229ff4d3bc96f1f221ebf36443fe (patch)
tree6984a21c8457dbc5289d76b7d3e5137310197166
parent574774980cfdfe72d77cec831024f0229d10a1f3 (diff)
downloadgit-880c0aef0fa8229ff4d3bc96f1f221ebf36443fe.tar.gz
builtin/mailsplit.c: use error_errno()
There's one change, in split_mbox(), where an error() without strerror() as argument is converted to error_errno(). This is correct because the previous call is fopen (not shown in the context lines), which should set errno if it returns NULL. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/mailsplit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
index 104277acc4..4859ede38a 100644
--- a/builtin/mailsplit.c
+++ b/builtin/mailsplit.c
@@ -109,7 +109,7 @@ static int populate_maildir_list(struct string_list *list, const char *path)
if ((dir = opendir(name)) == NULL) {
if (errno == ENOENT)
continue;
- error("cannot opendir %s (%s)", name, strerror(errno));
+ error_errno("cannot opendir %s", name);
goto out;
}
@@ -174,12 +174,12 @@ static int split_maildir(const char *maildir, const char *dir,
f = fopen(file, "r");
if (!f) {
- error("cannot open mail %s (%s)", file, strerror(errno));
+ error_errno("cannot open mail %s", file);
goto out;
}
if (strbuf_getwholeline(&buf, f, '\n')) {
- error("cannot read mail %s (%s)", file, strerror(errno));
+ error_errno("cannot read mail %s", file);
goto out;
}
@@ -210,7 +210,7 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
int file_done = 0;
if (!f) {
- error("cannot open mbox %s", file);
+ error_errno("cannot open mbox %s", file);
goto out;
}
@@ -318,7 +318,7 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
}
if (stat(arg, &argstat) == -1) {
- error("cannot stat %s (%s)", arg, strerror(errno));
+ error_errno("cannot stat %s", arg);
return 1;
}