umask question

David Kramer david at thekramers.net
Fri Jul 12 11:47:55 EDT 2002


On Fri, 12 Jul 2002, Nathan Meyers wrote:

> On Fri, Jul 12, 2002 at 11:24:14AM -0400, David Kramer wrote:
> > (this is on freebsd if it matters)
> > 
> > If I "umask 0" and create a file, that file is coming out 666 instead of 
> > 777.  Am I missing something?
> 
> Creating it how - from a shell, in a program? With system or stdio calls?
> 
> The mode of a newly created file is set (and modified by the umask)
> in the low-level creat(2) or open(2) system call. Most applications -
> including anything using the C library's fopen(3) call - don't set the
> execute bits at the time the file is created. So your umask setting
> allows the execute bits to be set at file creation if the app requests
> it... but the app still has to request it.
> 
> Nathan Meyers
> nmeyers at javalinux.net
> 

Thanks.  That just seems so wrong to me though.  If I set a umask, why 
wouldn't creat() and open() honor it?  Isn't that what umask is for?


----------------------------------------------------------------------------
DDDD   David Kramer         david at thekramers.net       http://thekramers.net
DK KD  
DKK D  Python is executable pseudocode
DK KD  Perl is executable line noise
DDDD                                                             Bruce Eckel




More information about the Discuss mailing list