On Sun, May 1, 2016 at 7:14 AM, Nguyễn Thái Ngọc Duy <pclo...@gmail.com> wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
> ---
> diff --git 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;
>                 }
> @@ -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);

Unlike other cases in this patch which already printed
strerror(errno), this one didn't, and the patch upgrades it to do so,
which is valid since errno will not be clobbered between the preceding
fopen() and this error_errno(). I see other patches in the series do
likewise.

The error("cannot read mbox %s"" just below this code doesn't deserve
the same treatment because strbuf_getwholeline() doesn't promise a
meaningful errno. Okay.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to