An extra note on this. After pondering over it for a bit, I've realised
that this solution is only correct for 1-bit masks, ie. for values like
0x800 and 0x010, but not for values like 0x120 and 0x600.
Now the vast majority of condition masks have only one bit set. However
this is not _ALWAYS_ for the case. And we all know that those special
cases are going to catch us off-guard one of these days...
If you know the mask has multiple bits set (or alternatively you don't
care to know, and just want the code to work either way), then you need
to do something like this:
((program_filemode & S_ISUID) == S_SUID) &&
((program_filemode & S_IXGRP) == 0)
The first half of the test makes sure _ALL_ of the S_SUID bits are _ON_,
and the second half makes sure that _ALL_ of the S_IXGRP bits are _OFF_.
Cheers,
--
Dennis Clark dbugger@nospam.progsoc.uts.edu.au PGP/MIME spoken here
-------------------------------------------------------------------------------
An engineer is someone who does list processing in FORTRAN.
--
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.
This list is archived at <http://www.progsoc.uts.edu.au/lists/progsoc/>