Download raw body.
Fix for vi editing mode in sftp(1) (PING)
On Tue, Jan 20, 2026 at 09:40:49AM +0000, Stuart Henderson wrote: > On 2026/01/20 04:10, Christian Schulte wrote: > > Am 20.01.2026 um 00:44 schrieb Crystal Kolipe: > > > > > > So what Stuart suggested, whilst technically not absolutely necessary, is good > > > programming practice. > > > > > > > The manual should be the only source to decide things like this and this > > only says: > > > > el_set() ... Returns 0 on success, -1 on failure. > > el_get() ... Returns 0 if successful, -1 otherwise. > > > > The return value of el_set is not checked either. I did not take a > > If the existing unchecked el_set() calls fail it's not a big problem and > there isn't really anything sftp(1) can do differently. > > If el_get() fails you can't assume anything about the contents of the > pointer so it's not safe to use it. (Also remember that this code will > run with editline implementations other than OpenBSD's so being a bit > careful with this is appropriate). This is correct, your version of the patch testing the return value of el_get() before using the value of editor[0] would certainly be the correct approach. My explanation was intended to answer Walter's, "I don't follow what you're telling me here" comment, in a way that future readers of the archives trying to get a start writing, (decent quality), patches could learn from.
Fix for vi editing mode in sftp(1) (PING)