[Top][All Lists]

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

Re: [PATCH] lib/isatty.c - Remove IsConsoleHandle(h)

From: Pádraig Brady
Subject: Re: [PATCH] lib/isatty.c - Remove IsConsoleHandle(h)
Date: Mon, 09 Jun 2014 09:33:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 06/09/2014 03:40 AM, address@hidden wrote:
> isatty.c contains an "optimized test" to determine whether or not something 
> is sent to terminal based on the low two bits. 
> I don't see the purpose behind the optimization.  It's only called after the 
> _isatty(fd), meaning gnulib already has an accurate confirmation on whether 
> or not the call is valid.  

It's an optimized test rather than an optimization for isatty() itself.
Without this call the isatty() replacement is moot because the
reason it exists on mingw is to double check the handle as there
true is returned for the NUL device.

> More importantly, it breaks on Windows 8, where all handles are multiples of 
> 4.  The result is a false negative, and an unclean output from a freshly 
> compiled glib. 

Ugh fair enough. So it seems these lower 2 bits are still significant,
just not used for tagging consoles any more?
So is isatty(nul_handle) still returning true there?
If not, then we could use a direct test of isatty(nul_handle)
to enable the replacement.
Note also the replacement is useful on "MSVC 9" to avoid an
exception for isatty(invalid_handle), which we'd have to consider.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]