Re: [PATCH v2 08/41] builtin/mailsplit.c: use error_errno()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 3, 2016, 19:48 UTC
- Message-ID
- <xmqqinyuncro.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1462277054-5943-9-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 9 quoted lines
> diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
> - error("cannot opendir %s (%s)", name, strerror(errno));
> + error_errno("cannot opendir %s", name);
> - error("cannot open mail %s (%s)", file, strerror(errno));
> + error_errno("cannot open mail %s", file);
> - error("cannot read mail %s (%s)", file, strerror(errno));
> + error_errno("cannot read mail %s", file);
> - error("cannot stat %s (%s)", arg, strerror(errno));
> + error_errno("cannot stat %s", arg);These all used to use its own formatting, but will use "<message>: <errno>" format like everybody else, which is good.
Show 8 quoted lines
> @@ -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;
> }It may be a bit unclear from the context, but it uses errno that was set when fopen() returned a NULL.
The changes in this patch are not faithful conversion like other patches, but they are all good, I would say.
Thanks.