Mailinglist Archive: opensuse (3506 mails)

< Previous Next >
Re: [SLE] Samba File Permissions
  • From: Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx>
  • Date: Fri, 8 Sep 2006 13:50:11 +0000 (UTC)
  • Message-id: <Pine.LNX.4.61.0609081547370.25316@xxxxxxxxxxxxxxx>
>>
>> 4 | 2 | 1 = 7
>
>To be perfectly correct, 4+2+1 is *exactly* the same as 4|2|1:

Yes but only that speicific case.

>The only time there's a difference between + and | is when the bit
>patterns of the numbers overlap. e.g., 3+1 ist not the same as 3|1:
>
>binary 011 + 001 == 100
>binary 011 | 001 == 011

It becomes important as you write code:

S_IRUSR | S_IWUSR | S_IXUSR
S_IRUSR + S_IWUSR + S_IXUSR

as you cannot rely on S_I[RWX]USR being single-bit values.



Jan Engelhardt
--

< Previous Next >
Follow Ups