This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: Problems on accessing Windows network resources
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Corinna Vinschen <cygwin-patches at cygwin dot com>
- Date: Sat, 12 Jul 2003 15:09:42 -0400 (EDT)
- Subject: Re: Problems on accessing Windows network resources
- Reply-to: cygwin-patches at cygwin dot com
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/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,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