From: Mitchell Blank Jr Date: Sat, 19 Aug 2006 17:15:34 GMT Subject: Re: [PATCH] Added support for dropping privileges to git-daemon. Message-ID: <20060819171534.GA64962@gaz.sfgoth.com> In-Reply-To: Marco Costalba wrote: > >> >+ if (!user ^ !group) > >> >+ die("either set both user and group or none of them"); > > BTW the following (very ugly) works. > > if ((int)user ^ (int)group) No it doesn't. Besides being a dangerous cast (no guarantee that a pointer will fit in an "int") your code is basically just a fancy way of saying if (user != group) Which is definitely NOT what is intended. "user" and "group" are pointers -- unless they're both NULL we expect them to have different values. The original code is equivalent to: if ((user == NULL) != (group == NULL)) which is what is actually intended. -Mitch