Re: [PATCH] Cygwin: pty: Add error handling in setup_pseudoconsoe().
On Feb 11 00:12, Takashi Yano wrote:
> - In setup_pseudoconsole(), many error handling was omitted. This
> patch adds missing error handling.
> winsup/cygwin/fhandler_tty.cc | 94 +++++++++++++++++++++++++----------
> 1 file changed, 68 insertions(+), 26 deletions(-)
Uhm... please, no. There's no problem adding goto labels per se, but
jumping back to numbered error labels is quite confusing.
Error labels should ideally be at the end of the function and in reverse
order of the potentially failing code. For more than one error label,
the label names ideally reflect the problem they are solving. For
if (<something failed>)
<do something else>
if (<something else failed>)
<do some other stuff>
if (<some other stuff failed>)
<cleanup some other stuff>
<cleanup something else>
I wouldn't expect that all functions in Cygwin follow this approach yet,
but for new code I'd rather see it like this.