[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Terminal resize crashes during lock-file prompt
From: |
Benno Schulenberg |
Subject: |
Re: Terminal resize crashes during lock-file prompt |
Date: |
Fri, 22 May 2020 16:40:25 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Op 22-05-2020 om 04:00 schreef Marco Diego Aurélio Mesquita:
> I saw the bug introduced in 10800ee410286c3f19ffa7fd563fe0cf08e3a68a
> and the fix in e0d00bc750d4f984a298175a9a8e8d3f30ae948d .
You have your references wrong. 10800ee4 introduced no bug,
but avoids an unlikely one. And e0d00bc7 is just a tweak to
silence the compiler.
> Wouldn't it
> be simpler/better to do just this:
>
> - if (fd > 0)
> + if (fd >= 0)
I wouldn't call that simpler. It takes me more time to process ">="
than ">".
> Considering that "man 3 open" just says:
>
> Upon successful completion, these functions shall open the file and
> return a non-negative integer representing the lowest numbered unused
> file descriptor.
>
> I see no reason why open could not return 0.
File descriptor 0 is always stdin. Which means that open() cannot
return 0, because in that case nano would not be connected to any tty
and would not be able to function.
https://en.wikipedia.org/wiki/File_descriptor
Benno
signature.asc
Description: OpenPGP digital signature