Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Aug 7, 2018, 15:25 UTC
- Message-ID
- <CAP8UFD3KbDrvU3zj24F7FF9ui2X75Vih4CoYE=cCZEWMsKP9Fw@mail.gmail.com>
- In-Reply-To
- <d83efc2e-3538-9547-244f-ca7653498c22@talktalk.net>
Hi Phillip,
On Tue, Aug 7, 2018 at 3:57 PM, Phillip Wood <phillip.wood@talktalk.net> wrote:
Show 17 quoted lines
>
> On 31/07/18 18:59, Alban Gruin wrote:
>>
>> +
>> + ret = fputs(buf.buf, todo);
>
> It is not worth changing the patch just for this but strbuf_write()
> might be clearer (you use it in a later patch)
>
>> + if (ret < 0)
>> + error_errno(_("could not append help text to '%s'"), rebase_path_todo());
>> +
>> + fclose(todo);
>
> You should definitely check the return value and return an error if
> appropriate as fputs() might not actually write any data until you try
> and close the file.I agree about checking the return value from fputs(), but it seems to me that we don't usually check the value of fclose().
Thanks, Christian.