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

Re: Bug in mkdir(2)?



On 15 Aug 1999, Ben Pfaff wrote:

>Steve McIntyre <stevem@chiark.greenend.org.uk> writes:
>
>   I find this difficult to believe, but I can't find any documentation to
>   say one way or the other. mkdir(2) takes a mode but ignores the
>   higher-order bits (e.g. the sticky bit). The following (simple) source
>   demonstrates this: 
>
>This is normal, I think.  do_mkdir() in fs/namei.c in the kernel
>contains the following fragment
>        mode &= 0777 & ~current->fs->umask;
>which sets all the mode bits to 0 except the low-order ones.  Thus, it
>seems to me that this is expected behavior.

Ah, OK. Thanks. It might be useful if this was documented in the man/info
page for mkdir, as it's not obvious. It also seems a little silly IMHO -
you obviously want to kill the higher order bits that denote directory /
socket type, but I don't see a reason for killing these. Oh well.

-- 
Steve McIntyre, Cambridge, UK.                   stevem@chiark.greenend.org.uk
                             Also available from steve_mcintyre@geocities.com
"Can't keep my eyes from the circling sky,                 +------------------
"Tongue-tied & twisted, Just an earth-bound misfit, I..."  |Finger for PGP key


Reply to: