Re: [PATCH 17/18] revert: Introduce --continue to continue the operation

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

 



Hi Junio,

Junio C Hamano writes:
> Ramkumar Ramachandra <artagnon@xxxxxxxxx> writes:
>>>> +     for (p = buf.buf; *p; p = strchr(p, '\n') + 1) {
>>>
>>> This relies on a "\n" at the end of the last line...
>>
>> Yes, that was intentional.  Every editor I know of inserts a '\n' at
>> the end of the last line,...
>
> Why do you think "diff" has a special codepath to report "No newline at
> end of file"? Because some editors do leave an incomplete line incomplete.
>
> When working on a "buf" with an incomplete line at the end, the last round
> of the loop will assign "(char *) 1" to "p", try to see "*p" is NUL and
> segfault, no?

Thanks for the excellent explanation! :)
I'll fix this and re-roll asap: I'll take the opportunity to include
the other changes that Christian suggested.

-- Ram
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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