Re: [PATCH 08/41] builtin/mailsplit.c: use error_errno()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 1, 2016 at 7:14 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]