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

From: Junio C Hamano <[email-masked]>
Date: Tue, 03 May 2016 12:48:43 -0700

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> 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.

> @@ -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.