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

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

 



On 8/19/06, Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx> wrote:
Marco Costalba [2006-08-19 15:23]:
> >
> >+       if (!user ^ !group)
> >+               die("either set both user and group or none of them");
> >+
> >
>
> Just a  question. Why simply not
>
>       if (user ^ group)

Because gcc doesn't like that:
 error: invalid operands to binary ^


Interesting!

Indeed gcc it's right, operator ^ it's a bitwise operator, not a
logical one. So operands must be booleans (or numerical types in case
of C).

The trick is that operator '!' performs an implicit conversion to
integral on the 'user' and 'group' pointers.

BTW the following (very ugly) works.

        if ((int)user ^ (int)group)
-
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]