On Sat, 12 Jul 2003, Corinna Vinschen wrote:

> On Sat, Jul 12, 2003 at 09:37:37AM -0400, Pierre A. Humblet wrote:
> > At 10:31 AM 7/12/2003 +0200, Corinna Vinschen wrote:
> >
> > >thanks for the patch but it has a problem.  You're comparing tokens against
> > >NULL while the correct "NULL" value for tokens is INVALID_HANDLE_VALUE.
> >
> > Corinna,
> >
> > That's by design, using of Chris' astute observations. As he once
> > pointed out, INVALID_HANDLE_VALUE is the value returned in case of error
> > but NULL is not a legal handle value either, as implied by CreateFile
> > itself. Microsoft is using NULL handle values all the time. For the
> > specific case of a NULL token handle, see SetThreadToken.
>
> What I don't like is that tokens can get both values now.  Most of the
> time they are initialized to INVALID_HANDLE_VALUE, your code introduces
> additionally NULL values.  At one point we will suddenly get a problem
> because a `if (!foo_token)' doesn't handle the INVALID_HANDLE_VALUE case.
>
> Regardless if INVALID_HANDLE_VALUE or NULL is the correct value, I want
> to see only one of them used in Cygwin internally.
>
> Corinna

How about an IS_VALID_TOKEN() macro?
        Igor
-- 
                                http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_                [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            [EMAIL PROTECTED]
     |,4-  ) )-,_. ,\ (  `'-'           Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

Reply via email to