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>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2016-05-08 16:47:28 +07:00 коммит произвёл Junio C Hamano
Родитель 574774980c
Коммит 880c0aef0f
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -109,7 +109,7 @@ static int populate_maildir_list(struct string_list *list, const char *path)
if ((dir = opendir(name)) == NULL) { if ((dir = opendir(name)) == NULL) {
if (errno == ENOENT) if (errno == ENOENT)
continue; continue;
error("cannot opendir %s (%s)", name, strerror(errno)); error_errno("cannot opendir %s", name);
goto out; goto out;
} }
@ -174,12 +174,12 @@ static int split_maildir(const char *maildir, const char *dir,
f = fopen(file, "r"); f = fopen(file, "r");
if (!f) { if (!f) {
error("cannot open mail %s (%s)", file, strerror(errno)); error_errno("cannot open mail %s", file);
goto out; goto out;
} }
if (strbuf_getwholeline(&buf, f, '\n')) { if (strbuf_getwholeline(&buf, f, '\n')) {
error("cannot read mail %s (%s)", file, strerror(errno)); error_errno("cannot read mail %s", file);
goto out; goto out;
} }
@ -210,7 +210,7 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
int file_done = 0; int file_done = 0;
if (!f) { if (!f) {
error("cannot open mbox %s", file); error_errno("cannot open mbox %s", file);
goto out; goto out;
} }
@ -318,7 +318,7 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
} }
if (stat(arg, &argstat) == -1) { if (stat(arg, &argstat) == -1) {
error("cannot stat %s (%s)", arg, strerror(errno)); error_errno("cannot stat %s", arg);
return 1; return 1;
} }