Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

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

 



Hi Phillip,

On Tue, Aug 7, 2018 at 3:57 PM, Phillip Wood <phillip.wood@xxxxxxxxxxxx> wrote:
>
> 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.



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

  Powered by Linux