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>

Nguyễn Thái Ngọc Duy committed May 8, 2016 at 16:47 UTC 880c0aef0fa8229ff4d3bc96f1f221ebf36443fe
1 file changed +5 -5
builtin/mailsplit.c
+5 -5
@@ -109,7 +109,7 @@ static int populate_maildir_list(struct string_list *list, const char *path)
109 if ((dir = opendir(name)) == NULL) {
110 if (errno == ENOENT)
111 continue;
112 - error("cannot opendir %s (%s)", name, strerror(errno));
112 + error_errno("cannot opendir %s", name);
113 goto out;
114 }
115
@@ -174,12 +174,12 @@ static int split_maildir(const char *maildir, const char *dir,
174
175 f = fopen(file, "r");
176 if (!f) {
177 - error("cannot open mail %s (%s)", file, strerror(errno));
177 + error_errno("cannot open mail %s", file);
178 goto out;
179 }
180
181 if (strbuf_getwholeline(&buf, f, '\n')) {
182 - error("cannot read mail %s (%s)", file, strerror(errno));
182 + error_errno("cannot read mail %s", file);
183 goto out;
184 }
185
@@ -210,7 +210,7 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
210 int file_done = 0;
211
212 if (!f) {
213 - error("cannot open mbox %s", file);
213 + error_errno("cannot open mbox %s", file);
214 goto out;
215 }
216
@@ -318,7 +318,7 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
318 }
319
320 if (stat(arg, &argstat) == -1) {
321 - error("cannot stat %s (%s)", arg, strerror(errno));
321 + error_errno("cannot stat %s", arg);
322 return 1;
323 }
324