Re: [PATCH v2 09/21] blame: report error on open if graft_file is a directory

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

 



Hi Duy,

On Wed, 3 May 2017, Nguyễn Thái Ngọc Duy wrote:

> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  builtin/blame.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 07506a3e45..1648b396dc 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -2071,10 +2071,12 @@ static int prepare_lines(struct scoreboard *sb)
>   */
>  static int read_ancestry(const char *graft_file)
>  {
> -	FILE *fp = fopen(graft_file, "r");
> +	FILE *fp = fopen_or_warn(graft_file, "r");
>  	struct strbuf buf = STRBUF_INIT;
> +
>  	if (!fp)
>  		return -1;
> +
>  	while (!strbuf_getwholeline(&buf, fp, '\n')) {

This is an excellent example to demonstrate why folding all conversions to
fopen_or_warn() into the same patch as introducing that function makes
sense: I had to close this mail, find the mail with the patch introducing
the function, verify that it returns NULL as before, close that mail, and
continue this reply.

Oh, and I do not think it is a good idea to introduce style fixes in the
middle of such a large patch series. It's a bit distracting from the real
meat here.

Ciao,
Dscho

[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]