Re: [PATCH] Added support for dropping privileges to git-daemon.

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

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]