git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mitchell Blank Jr <mitch@sfgoth.com>
To: Marco Costalba <mcostalba@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Added support for dropping privileges to git-daemon.
Date: Sat, 19 Aug 2006 10:15:34 -0700	[thread overview]
Message-ID: <20060819171534.GA64962@gaz.sfgoth.com> (raw)
In-Reply-To: <e5bfff550608190819i3cade548g28b2c95fab172a49@mail.gmail.com>

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

  parent reply	other threads:[~2006-08-19 17:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-19 12:27 [PATCH] Added support for dropping privileges to git-daemon Tilman Sauerbeck
2006-08-19 13:23 ` Marco Costalba
2006-08-19 13:29   ` Tilman Sauerbeck
2006-08-19 15:19     ` Marco Costalba
2006-08-19 15:22       ` Marco Costalba
2006-08-19 17:15       ` Mitchell Blank Jr [this message]
2006-08-19 13:32 ` Johannes Schindelin
2006-08-19 17:25 ` Mitchell Blank Jr
2006-08-19 12:27   ` Tilman Sauerbeck
2006-08-22  6:38     ` Junio C Hamano
2006-08-22 17:37       ` Tilman Sauerbeck
2006-08-22 23:40         ` Junio C Hamano
2006-08-23 16:45           ` Tilman Sauerbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060819171534.GA64962@gaz.sfgoth.com \
    --to=mitch@sfgoth.com \
    --cc=git@vger.kernel.org \
    --cc=mcostalba@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).